How to enable TRIM in Mac OS X on third-party SSDs
Switching out a traditional hard disk drive (HDD) for a more modern Solid State Drive (SSD) is a great way to significantly boost the performance of an older Mac.
Until recently however, there has been a problem with doing that - officially Mac OS X has not supported the important TRIM feature on any SSDs except the models built into new Macs by Apple themselves.
TRIM cleans up your SSD when files are deleted, and helps keeps things running smoothly. If TRIM is not enabled, the performance of the SSD can decrease over time.
There have been workarounds to enable TRIM on third party SSDs, however they all involved potentially compromising the security and stability of the Mac in question. Happily, Apple has begun offering an easier way to enable TRIM called trimforce, which is included in releases of OS X from Yosemite 10.10.4 onwards.
Note: these instructions only apply if your Mac has been fitted with an after market third party SSD. If your Mac came with an SSD from the start, you do not need to enable TRIM - Apple will have taken care of that for you.
Enable TRIM on Third Party SSDs
Before enabling TRIM you should ensure all the important files and applications on your Mac are backed up. Once the procedure is complete your Mac will also automatically reboot, so save any open documents before starting.
Once all your files are saved and backed up, launch the Terminal application and enter the following command:
sudo trimforce enable
When prompted, enter your Mac's administrator password and press enter. You'll see a message like the one below warning you about the risks of enabling TRIM, and reminding you the TRIM enabler comes with no warranty of any kind.
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)?
If you're happy to proceed, type
Y and press
Enter. TRIM will enable, and then after a few moments a message will appear informing you your Mac needs to reboot for the changes to take effect. Type
Y and press
Enter again and your Mac will shutdown and restart. When it comes back up, TRIM will be enabled!
If for any reason you want to disable TRIM again, simply follow the above steps and substitute the first command you entered for this one:
sudo trimforce disable
Again your Mac will need to reboot for the changes to take effect, so be sure to save and backup any files beforehand.
Who needs to enable TRIM?
There has been some confusion about whether owners of modern SSDs really need to enable TRIM at all. This has mostly come about because of two factors which have resulted in the wide spread of misinformation.
Firstly, recent marketing campaigns by several SSD manufacturers have made claims that newer SSD models have the same functions that TRIM provides built into the firmware of the drives themselves, and therefore these drives do not benefit from having TRIM enabled.
Secondly, there was a bug with SSDs manufactured by certain companies (such as Samsung) which caused the drives to incorrectly delete data and wipe important files from user's systems when TRIM was enabled on Linux.
The general recommendation however, is that Mac users enabling TRIM should not experience any unwanted side effects. While newer SSDs do have more features built in to their firmware, they still do not provide a full substitute for using TRIM. There has also been no evidence to suggest that the data loss bug affects any non-Linux systems.