Turn On TRIM For Any SSD You Added To Your Mac
Ever since Apple first offered Macs with SSDs, they've included support for TRIM, a method for the OS to assist an SSD in freeing up space.
TRIM Command
The TRIM command is issued by the operating system to assist an SSD in cleaning up data in storage blocks that are no longer needed. This helps the write performance of an SSD by keeping more blocks of data free to be written to. It also keeps the SSD from being aggressive in cleaning up after itself and causing wear on the memory chips, leading to early failure.
TRIM is supported in OS X Lion (10.7) and later, but Apple only enables the TRIM command for use with Apple-supplied SSDs. It’s not clear why Apple limited TRIM support this way, but the conventional wisdom is that TRIM implementation is up to the SSD manufacturer, and each SSD manufacturer uses a different TRIM methodology. As such, Apple only wanted to use TRIM on SSDs that it has certified.
That left those of us who like to upgrade our Macs out in the cold, at least when it came to running performance-enhancing SSDs. Without support for TRIM, there was a possibility that over time, our expensive SSDs would slow down, and we would see a real performance drop in writing to the SSD.
Thankfully, there are a few third-party utilities that can enable TRIM for non-Apple-supplied SSDs, including TRIM Enabler, one of my Mac software picks in 2014. These utilities make use of Apple’s built-in TRIM support; they just removed the ability for the OS to check if the SSD is on Apple’s list of approved manufacturers.
Apple Makes TRIM Available to All SSDs
Starting with OS X Yosemite 10.10.4 and later, Apple made TRIM available to any SSD, including those installed by DIYers, like many of us here at About: Macs, and many of you. But although Apple now supports third-party SSDs, it turned TRIM off for non-Apple-supplied SSDs, and left it up to the user to manually turn TRIM support on, if so desired.
Should You Use TRIM?
Some early-generation SSDs had unusual implementations of the TRIM function that could lead to data corruption. For the most part, these early SSD models were difficult to come across, unless you picked one up from a source that specialized in used products, such as flea markets, swap meets, or eBay.
One thing you should do is check with the SSD manufacturer to see if there are any firmware updates for the SSD model you have.
It’s not just older SSDs that can have problems, though. Some popular SSD models, such as Samsung 840 EVO, 840 EVO Pro, 850 EVO, and 850 EVO Pro, have exhibited problems with TRIM that can lead to data corruption. Luckily for us Mac users, the Samsung TRIM issues seem to only become apparent when used with queued TRIM commands. OS X only makes use of sequential TRIM commands at this time, so enabling TRIM with the Samsung line of SSDs should be OK, as reported by MacNN.
The Importance of Backups
I’ve been using the TRIM command with the third-party SSD I installed in our Mac Pro without issues, however, before enabling TRIM I made sure that I had a backup system in place. Should an SSD exhibit a failure caused by TRIM, it's likely to involve large blocks of data being reset, causing non-recoverable file loss. Always have a backup system in place.
How to Enable TRIM in OS X
Before you proceed, remember the TRIM function is automatically enabled for Apple-supplied SSDs; you only need to execute the following steps for third-party SSDs you installed as upgrades.
- Launch Terminal, located in the /Applications/Utilities folder.
- At the Terminal command prompt, enter the text below: (Tip: you can triple-click the command line and then copy/paste it into the Terminal window.)
sudo TRIMforce enable
- When requested, enter your administrator password.
- Terminal will then produce one of the more scary warnings that Apple has come up with yet:
“IMPORTANT NOTICE: This tool force-enables TRIM for all relevant attached devices, even though such devices may not have been validated for data integrity while using TRIM. Use of this tool to enable TRIM may result in unintended data loss or data corruption. It should not be used in a commercial operating environment or with important data. Before using this tool, you should back up all of your data and regularly back up data while TRIM is enabled. This tool is provided on an “as is” basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THIS TOOL OR ITS USE ALONE OR IN COMBINATION WITH YOUR DEVICES, SYSTEMS, OR SERVICES. BY USING THIS TOOL TO ENABLE TRIM, YOU AGREE THAT, TO THE EXTENT PERMITTED BY APPLICABLE LAW, USE OF THE TOOL IS AT YOUR SOLE RISK AND THAT THE ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY AND EFFORT IS WITH YOU.
Are you sure you wish to proceed (y/N)?” - Pretty darned scary, but as long as you have a current backup, and a system like Time Machine to keep your backups current, you shouldn't worry too much about taking advantage of TRIM to keep your SSD in tip-top shape.
- Enter y at the Terminal prompt to enable TRIM, or N to leave TRIM turned off for third-party SSDs.
- Once TRIM is enabled, your Mac will need to be rebooted to take advantage of the TRIM service.
A Few Additional Notes About TRIM
TRIM isn't supported in external enclosures that use USB or FireWire as the method of connection to your Mac. Thunderbolt enclosures with SSDs do support the use of TRIM.
Turning TRIM Off for Third-Party SSDs
Should you decide you don’t wish to have TRIM turned on for third-party SSDs, you can use the TRIMforce command to disable TRIM by following the instructions above and replacing the Terminal command with:
sudo TRIMforce disable
Just as when you turned TRIM on, you'll need to reboot your Mac to complete the process of turning TRIM off.
Published: 7/28/2015
Updated: 8/1/2015