Enable TRIM in Mac OS X Lion

If you are a using a third party SSD that supports TRIM, then, you will manually have to patch it in order to make the TRIM enabled on your Macbook Pro. It requires you to type in commands into the Terminal, so be careful. Follow these instructions to patch your OS X Lion to activate TRIM


Start up terminal app (find it in the applications). First, backup the files we are going to patch.

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

Then, type in this

sudo perl -pi -e ‘s|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00).{9}(\x00\x51)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg’ /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage

Now, we will clear the OS X Lion’s kernel extension cache.

sudo kextcache -system-prelinked-kernel
sudo kextcache -system-caches

Restart your Mac. That is it. You have enabled TRIM on your Apple notebook.