With the introduction of solid state drives (SSDs), Apple began enabling TRIM support only on its OEM supplied drives to ensure a predictable compatibility with the TRIM protocol as some 3rd party drives weren’t fully supported. TRIM Disabled

To manually override and enable this feature on a new SSD supporting a proper implementation of TRIM, the following shell commands will do the trick. Patching the kernel extension (kext) responsible is unique to your version of OS X (or macOS). Third party enabling software does exist.

Patching OS X 10.6.8

To patch the kext for TRIM support in Mac OS X Snow Leopard 10.6.8, fire up a terminal window and enter the following:

Begin by backing up the original kext driver to your home directory

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

Then search for and replace the segment of code responsible for limiting TRIM support to Apple OEM devices only.

The following code is specific to 10.6.8 only!

sudo perl -pi -e 's|\x41\x50\x50\x4c\x45\x20\x53\x53\x44|\x00\x00\x00\x00\x00\x00\x00\x00\x00|g' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage

After patching, purge all kext caches in OS X with the following commands

sudo kextcache -system-prelinked-kernel
sudo kextcache -system-caches
sudo touch /System/Library/Extensions/

The last step is restarting your mac. You can do so manually or, if you still have the terminal window open, enter the following:

sudo reboot

TRIM Disabled

In case you no longer wish to have this enabled, simply restore the original kext file you saved in the first step:

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

It took some trial and error to assemble this guide as most resources I’ve found were either incorrect or were for other macOS/OS X versions.

For other OS X or macOS versions

10.7.5, 10.8.1, 10.8.2

Exchange the search and replace string above in the second command with the following

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

10.8.3 to 10.9.3

Exchange the search and replace string above in the second command with the following

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

10.9.4 & 10.9.5

Exchange the search and replace string above in the second command with the following

sudo perl -pi -e 's|(^\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

Resources and references used include a gist by clarencesong on GitHub, a MacTrast post on the 2011 Trim Support Enabler 1.1 third party tool by Oskar Groth and a functional 10.6.8 patch code by MacKonsti.

Newer macOS laptops can benefit from the latest version of Oskar Groth’s Trim Enabler 4 app. Although I’ve never used it, it will probably save you the headache of being on top of the latest updates/ changes to macOS.