The Blog is Back!and I Made a Change!
Learn more featured post
Jasonnash
27
March, 2011

It’s About Time. Enabling TRIM Support on OSX for Your SSD – UNSUPPORTED!

Two disclaimers:

Disclaimer 1 – This is NOT supported by Apple or your SSD manufacturer.  It is a hack to enable TRIM support in OSX that was not intended to be used on other SSDs besides the models that Apple ships in their systems.  It’s also not supported by me or those that provided info on this.  You could very well corrupt data.  Perform a backup!  Don’t whine to me if something breaks!

Disclaimer 2 – I take no credit for the information in this post about how to enable TRIM.  It came from this post and I’m just writing a simpler guide and showing that it does indeed work.  Credit goes to those guys, not me.

Note: There is now an automatic patching tool on the forum linked above.  I haven’t tested this yet.  This post is the manual way to enable support.

Note 2: I just tested this on my iMac that has the X25 G2 on the second SATA channel normally used by the Superdrive.  It did not enable TRIM so the kernel extension must only check the first SATA channel. Never mind here.  It turns out that when I put the X25G2 in my iMac I never updated the firmware.  I remember now that some benchmarks showed better performance with the old firmware in systems that didn’t support TRIM.  I’ll remedy this!

A while back I wrote this post on how to “refresh” an SSD with OSX, since OSX didn’t (and still technically doesn’t) support the TRIM feature that allows the OS to do the work.  With the release of OSX 10.6.7 Apple has slid in support for TRIM on SOME of their devices.  If you buy a new MacBook Pro right now you get TRIM support using the SSDs that Apple shipped.  But what about those with older MacBook Pros or those of us that didn’t want the Apple drive but instead chose a 3rd party?  Now there is hope.

Before moving forward perform a backup of your data and then read the disclaimers at the top again.

This isn’t a complicated “hack”.  It’s just simply changing an existing kernel extension using a hex editor.  If those words don’t make sense to you then you may want to wait to see if Apple adds support in 10.6.8 or in 10.7 (Lion).  Also, if your SSD doesn’t support the TRIM feature this won’t help you, so make sure yours does.  I use Intel X25 G2s and mine do with the current firmware.  Let’s go!

You’ll need three things to do this:

  • A hex editor.  I used I used 0XED, available here for free.
  • Kext Helper.  This is a tool that makes swapping kernel extensions much easier.  Click this.
  • You’ll need v2.05 of the IOAHCIFamily kernel extension.  Some new Macs ship with it…for the rest of us (even if you’ve upgraded to 10.6.7) you’ll need it.  Click here.

Download the IOAHCIFamily kernel extension and unzip it.  You should have a “file” that looks like IOACHIFAMILY.kext.  That is actually a package with a bunch of stuff in it.  Now that you’ve unzipped the file run the 0XED hex editor.  Go to File, Open, and then navigate to the IOACHIFAMILY.kext file and click it…you’ll see it expand.  Walk down to Contents -> Plugins -> IOAHCIBlockStorage.kext -> Contents -> MacOS -> IOAHCIBlockStorage.

Behold, hex.

In the search bar at the top right enter “APPLE SSD” without the quotes.  This will appear twice in the file.  This is the tag that the kernel driver uses to find the Apple SSD and enable TRIM.  Now we fool it!

We need to find out what to replace it with.  To do this go to About This Mac, More Info, Serial-ATA.  Then look to see what is listed next to “Model” for your SSD.  Mine says:  INTEL SSDSA2M160G2GN.  Here is the key.  We want the first *9* characters.  So for me I copied INTEL SSD to my clipboard.  That’s 9 characters including spaces.  Then go back to your hex editor.  On 0XED you highlight APPLE SSD on the right and just replace it with your characters.  Make SURE that you ONLY select APPLE SSD, no characters on either side of it.  It needs to be a 1 for 1 replacement.  Do this in both places that you find APPLE SSD.  Then click Save at the top and close 0XED.

Now to install the kernel extension.  Load Kext Helper.  Then bring up a Finder window and navigate to the folder with the IOAHCIFAMILY.kext file.  Drag and drop that kext in to the Kext Helper window.  Type your root password in the password field and click EASY INSTALL.  It should work for a minute and then declare the kext installed and wish you luck.  Comforting, eh?  If you get an error make sure your password is right.

One more thing just to be sure.  Open a Terminal window and type “sudo touch /System/Library/Extensions” to make sure that your kernel extension cache is updated.  I’m not sure if Kext Helper does this for you or not.

You did a backup, right?  REBOOT!

Once the system boots you should be able to go back in to About This Mac and look at your SSD.  It should now show “TRIM Support: Yes” if it worked AND your SSD supports TRIM.

Below are before and after benchmark numbers for my SSD to show that it does indeed work.  I dumped a bunch of data on my SSD to fill it up before the test to make sure the speed was degraded.

Before:

After:

5 thoughts on “It’s About Time. Enabling TRIM Support on OSX for Your SSD – UNSUPPORTED!”

Leave a Reply

Your email address will not be published. Required fields are marked *