Plextor USA

Home FAQ Storage Products Software issues Mac OS How to enable TRIM on OSX

How to enable TRIM on OSX

ANSWER:

How To Enable TRIM Support For All SSDs in OS X Lion

 Although Plextor SSD's are compatible with Mac computers, Apple has chosen to not provide support for any drives that are not Mac certified. This includes disabling the preference page which allows users to enable or disable TRIM. TRIM follows the process of marking areas as free by clearing the invalid data from the drive.  Without this, the process of reading, identifying invalid data, deleting or moving and clearing the block before writing, can actually result in performance 4 times slower than it would have normally been as a new drive.  If you have an SSD that supports TRIM, and you're running OS X 10.6.8 or Lion, follow these instructions taken from the Macrast website in order  to enable TRIM.  

 

TRIM can be enabled by using the following Terminal commands. Copy these commands and run them in Terminal:

Backup the file that you're about to patch:

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

Patch the file to enable TRIM support:

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

Clear the kext caches:

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

Important: reboot your Mac!

To disable TRIM support in the future:

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

Finally, if this does not work as expected, or if something goes wrong, simply restore the backup:

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

This patch simply edits a file called IOAHCIBlockStoage, removing a string that makes TRIM work for only Apple SSDs.


Chat Now!