How To Add TRIM Support on your Mac SSD

It is possible to do this by hand using the Terminal. It looks ugly but essentially what you’re doing is patching a low-level system file to allow TRIM to function with your SSD.

Just to be on the safe side, back up the file we’re modifying. Copy the following into a new Terminal window and hit Return (the Enter key).

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

You’ll be prompted to enter your administrative password, so type it in and press Return once more.

Use the following command to modify the kernel extension so that it activates TRIM support.

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
Important: This code is intended for use on OS X Mountain Lion 10.8.5 or above or OS X Mavericks.

To make the changes take effect, you need to manually refresh the kernel extension cache.

sudo touch /System/Library/Extensions/

Once done, reboot and TRIM should be active.

Author: Helicopter Jeff

I'm a vinyl decal cutting and designing, Astrophotography and general photography capturing, RC helicopter/quad copter pilot, Arduino and Raspberry Pi hardware/software developer, network, scripting and troubleshooting ninja living in the metro NY area. I am passionate about my hobbies so much I do them for a living. There's nothing better than getting paid to do what you love.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s