Should I enable TRIM with a third party (non-Apple) SSD?

I have an Intel 320 Series 120 GB solid state drive installed in the optical drive bay of my 2012 MacBook Pro 13". I'm not sure whether to use TRIM Enabler to enable TRIM.

I did enable it before on my 2011 MacBook Pro, but I not sure whether I really needed to. I never had problems with it enabled.

I also doesn’t want to tinker with this, when I’m not entirely sure. Maybe I should use TRIM, but enable it with something other than TRIM Enabler. I don’t know.

I know what TRIM does. And if you buy a Mac with a SSD from Apple, it is enabled by default.


TRIM and Garbage Collection (GC) are not the same, and are both necessary to maintain performance after the drive has been used for a while. GC only takes place in the background when idle, or when the OS needs to write to a previously used block.

TRIM proactively zeros unused areas in the background. This is why you see a slight performance hit, but on an SSD this is negligible and is a lot faster than waiting for GC to work on demand after you've been using the SSD for a while.

Using the TRIM enabler app is not advised, but you can enable it via the terminal by following these steps.

Including the Steps below (as there seems to be a certificate issue with that particular link) :

TRIM Enabler for OS X Lion, Mountain Lion, Mavericks

OK. Now that Lion’s out, people want their SSD TRIM support back. I have one thing to say:

DO NOT USE TRIM ENABLER (VERSION 1.1 OR 1.2) TO ENABLE TRIM ON LION.

After a little inspection of this application, I found that instead of patching the file, it replaces an entire kernel extension. This means that when you use TRIM Enabler with Lion, it replaces a critical kernel extension, with lots of dependencies, with an older one (from Snow Leopard 10.6.8). This is bad. Very bad. While TRIM does become enabled, the kernel extension you now have has the potential to cause a ton of problems. That means anything from kernel panics, to disk I/O delays…and the dreaded spinning beach ball.

After confronting the developer, Oskar Groth (who I refuse to link to), via his blog’s commenting system, I was told that I was simply trolling and spreading fear (even though I offered the alternative I share here). Apparently, the next version of TRIM Enabler will correctly patch the file, instead of replacing it, but that hasn’t happened yet.

So, here’s the proper way to enable TRIM support. Run these commands in Terminal:

  1. Backup the file we’re patching

sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.original

  1. If you’re using OS X Yosemite, disable KEXT signing

sudo nvram boot-args="kext-dev-mode=1"

  1. Patch the file to enable TRIM support

FOR ML 10.8.5 AND MAVERICKS DP4+

sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x54)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage

  1. Force a refresh of the system’s kernel extension cache

sudo touch /System/Library/Extensions/

  1. Now Reboot!

a) If in the future you want to disable TRIM support

FOR ML 10.8.5 AND MAVERICKS DP4+

sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00).{9}(\x00\x54)|$1\x41\x50\x50\x4C\x45\x20\x53\x53\x44$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage

sudo touch /System/Library/Extensions/

b) If something goes horribly wrong, restore the backup

sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.original /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage

All this patch does is simply replace the string “APPLE SSD” in the file IOAHCIBlockStorage with zeros. This happens to bypass the restriction of only allowing Apple branded SSDs. The backup of the original file is saved in the same directory as the original file.

To check if it worked, open up About This Mac, click the “More Info…” button then the “System Report” button. In the list on the left, choose “Serial-ATA”. Click on your SSD Drive and in the lower half of the screen you should now see “TRIM Support: Yes” instead of “No”.

Remember, if you have an older generation SSD, the hardware itself may not support TRIM …and therefore this patch won’t help you. This patch bypasses the restriction put in place by Apple to restrict TRIM support to Apple branded SSD drives.

You WILL need to re-apply this patch after each major update of OS X. That means for 10.7.1, 10.7.2, etc.

Credit where credits due, unlike the other TRIM Enabler, I originally found this on the InsanelyMac forums by digital_dreamer

As a note, the MD5 checksums for the original and patched file on 10.7.0 are as follows:

Original: 155b426c856c854e54936339fbc88d72

Modified: 945944136009c9228fffb513ab5bf734

If you have already used the other TRIM Enabler, you can do the following: a) Attempt to copy and replace the extension from another Mac running the same version. b) Attempt to copy and replace the extension from the Recovery partition (Open up Disk Utility and Mount Recovery HD) c) Reinstall Lion d) Wait it out till 10.7.1 and hope that the extension is replaced in the update (but it may not be), then re-patch the file

UPDATE

a) Applying this patch does NOTHING else other than enable TRIM for 3rd party SSD drives. If you start seeing other problems, they’re not because of this.

b) Using this patch has no effect on hard disk drives. Firstly, mechanical hard disk drives do not understand the TRIM command, so it is discarded. Secondly, the Apple driver isn’t stupid enough to send TRIM commands to your hard disk. It knows the difference between an SSD and a HDD.

c) The wiping free space option is ALWAYS greyed out, even on Apple based SSDs. As reported here, you can try using fsck -ffy in Single User Mode, but personally I haven’t tested it. I’m sure there isn’t too much to worry about, especially if your drive has garbage collection.

d) If TRIM isn’t enabled after patching either a) you didn’t follow the steps correctly or b) your drive doesn’t support TRIM. If your drive doesn’t support TRIM, there’s no need to revert the patch, it simply has no effect.

e) The TRIM patch is NOT vendor/model specific. You can patch the driver for any damn SSD drive. Hell, you can apply the patch if you only use HDDs, but that’d be a little silly.

f) Regarding RAID and SSDs on Mac. I’m not completely sure but…if you’re using Apple RAID then I assume TRIM will work as usual. If you’re using a hackintosh and using a RAID controller (i.e. Intel ICHR), then no, RAID will not work. In either case, you should use a drive with garbage collection.

UPDATE 2

Regarding SSD durability and comments by Hyram:

The durability of SSDs has sweet fuck all to do with Mac OS X TRIM. It’s a fact, and always has been, that SSDs aren’t as durable as hard disks. This is simply due it it being a new technology. SSDs fail often due to the wear on the cells incurred by reads and writes.

If you don’t know what TRIM is, you probably shouldn’t be using a 3rd party SSD drive. Many have reported these commands don’t work, but that simply isn’t true. It just shows that a lot of people here don’t know how to use Terminal, don’t know what Bash is, nor Perl. These aren’t the sort of people that should be messing around with this. Instead, buy a SSD drive that offers garbage collection….or a Mac with an Apple SSD.

There has also been some confusion about garbage collection and TRIM. TRIM is ALWAYS preferred over Garbage Collection and will likely yield better results. If you have garbage collection, you don’t necessarily need TRIM, but it’ll probably offer better performance and there’s always a chance there’ll be a degradation of speed over time. Therefore, when using Garbage Collection, you may have to take the drive out and do a secure erase so that everything is re-marked as free space.

A drive will never fail because you haven’t enabled TRIM, even if it doesn’t have garbage collection. They simply become slower and the speed is not restored until you perform a destructive erase on the drive. However, drives that support TRIM, but do not have GC, and do not have TRIM enabled (in the OS) may fail more quickly than without enabling TRIM. In a very basic sense, since the SSD is no longer told what data to free up, when writing new data it will also re-write the deleted data, essentially causing more write cycles and wearing down the durability of the drive. If TRIM were enabled, the new data would be written without the deleted data, and hence less write cycles and extended durability. This ONLY relates to the combination of a drive that supports TRIM with no GC, while TRIM is disabled in the OS

Running garbage collection and TRIM at the same time is NOT a problem. They’re designed to work together. You can look at it like so: TRIM is called by your OS each time space is freed up. Garbage Collection is run by the drive’s firmware when idle and determines which parts of the drive can be cleaned up and rearranged. TRIM is obviously more efficient and obviously the drive’s firmware is aware of the TRIM commands and accounts for this.

As for the statements by Hyram, I believe some of them to be completely false. While it’s true that using TRIM and garbage collection at the same time is essentially using two mechanisms to do the same thing, the firmware on your SSD drive is designed to handle these things. All SSD manufacturers, GC or not, recommend the use of TRIM.

There is zero evidence that Apple has specific code to handle their specific SSD hardware for reading and writing. TRIM is a standardized ATA command. However, it IS likely that Apple has designed their integrated SSDs (particularly in the Air) to not overheat. Basically, your SSD is likely to fail just as much in your MacBook as if it were surrounded by the same temperature in any other laptop.

Posted on November 17, 2011


I did this on Yosemite and badness abounded. (Got the 'stop sign' on the boot screen.)

To fix that problem, see this: https://www.cindori.org/trim-enabler-and-yosemite/

Also, after some digging, it seems one doesn't really need to do this on Yosemite after all. See here: https://www.cindori.org/safely-enable-trim-on-yosemite-and-el-capitan/

I've now got TRIM enabled on a Samsung 840 EVO SSD. Yahoo.


AFAIK the Intel SSD's have a build-in clean up feature, so if you enable TRIM it 'can' slow you disk down.

Here is an article from OWC: http://blog.macsales.com/11051-to-trim-or-not-to-trim-owc-has-the-answer - which have a simular build-in feature.