Macs only enable TRIM for the Apple-provided solid-state drives they come with. If you upgrade your Mac with an aftermarket SSD, your Mac won’t use TRIM with it. This reduces the drive’s performance.
Thanks to Mac OS X 10.10.4, it’s now possible to enable TRIM on any SSD in your Mac with a simple command. You no longer have to disable OS X’s security features and modify your system to do this.
Why TRIM is Important, and Why Macs Don’t Always Enable It by Default
When an operating system uses TRIM with a solid-state drive, it sends a signal to the SSD every time you delete a file. The SSD knows that the file is deleted and it can erase the file’s data from its flash storage. With flash memory, it’s faster to write to empty memory — to write to full memory, the memory must first be erased and then written to. This causes your SSD to slow down over time unless TRIM is enabled. TRIM ensures the physical NAND memory locations containing deleted files are erased before you need to write to them. The SSD can then manage its available storage more intelligently.
Windows 7 and newer have had built-in support for TRIM, which they enable for all SSDs. Historically, Mac OS X has only enabled TRIM for the solid-state drives Apple provides. Users who installed their own SSDs had to hunt down third-party tools that enabled TRIM in an unsupported way.
In OS X 10.10 Yosemite, Apple introduced “kext signing” — Kernel extension signing. This checks that all the drivers on a Mac are either unaltered or approved by Apple. As TRIM-enabling utilities worked at this low level, this locked them out. It was now necessary to disable the kext signing security mechanism to enable TRIM for these drives, reducing a Mac’s security. Starting with OS X 10.10.4, Apple now provides an official — but unsupported — way of enabling TRIM for any SSD.
Is it Safe to Enable TRIM on Your SSD?
Whether this is safe to do depends on the SSD you’re using in your Mac. Apple doesn’t want to be responsible for any issues, which is why OS X hides this functionality behind a command and a scary warning message.
Every solid-state drive implements TRIM in a slightly different way, and many SSD manufacturers only truly test for compatibility on Windows. Search company Algolia found some data corruption bugs with certain Samsung SSDs with TRIM on Linux, and similar issues may occur if you enabled TRIM for such drives on a Mac. There have also been reports of some Crucial drives not functioning properly with TRIM on Linux.
In fact, the Linux kernel contains a blacklist of SSDs that don’t support TRIM properly. You probably shouldn’t activate trimforce if you have one of the SSDs that appears on this blacklist in your Mac.
Beyond that, most drives seem to work properly with TRIM on Mac OS X. Mac users have used third-party TRIM-enabling utilities for years with a variety of SSDs. You may want to do some research and see what other Mac users have experienced when enabling TRIM with your SSD before continuing.
Activate TRIM with trimforce
Apple quietly added a new command named “trimforce” in a minor update to OS X 10.10 Yosemite — OS X 10.10.4. This utility is also included in OS X 10.11 El Capitan.
This command activates TRIM for every single SSD on your Mac. It disables the check that only allows TRIM to work with Apple-provided OEM solid-state drives. After you run it, TRIM will be enabled for all your solid-state drives. There’s no way to enable TRIM for one SSD and leave it disabled for another.
Warning: You do this at your own risk! It’s always a good idea to have backups of your important files, just in case.
To run trimforce, open a Terminal window (press Command + Space, type Terminal, and press Enter to launch a terminal via Spotlight). Type the following command into the terminal window and press Enter:
sudo trimforce enable
Enter your user account’s password at the prompt. After you do, you’ll need to read a scary-sounding warning and agree by typing a y.
Your Mac will immediately reboot after you agree to the second question with a y. After it reboots, TRIM will be enabled for all SSDs connected to your Mac.
If you want to disable trimforce and only use TRIM for Apple’s OEM solid-state drives, open a Terminal window again and run the following command:
sudo trimforce disable
Realistically, this should work properly with most SSDs on a Mac, just as enabling TRIM works properly for most SSDs on Linux. But there are a few outliers, and Apple doesn’t want to be responsible if your SSD’s hardware doesn’t implement TRIM properly and you run into problems.
Image Credit: kawaiikiri on Flickr