You are on page 1of 3

TRIM can be enabled by using the following Terminal

commands. Copy these commands and run them in


Terminal:
Backup the file that youre about to patch:
sudo cp
/System/Library/Extensions/IOAHCIFamily.kext/Contents/Plu
gIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBloc
kStorage /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/Plu
gIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBloc
kStorage
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/Plu
gIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBloc
kStorage
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/Plu
gIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBloc
kStorage
This patch simply edits a file called IOAHCIBlockStoage,
removing a string that makes TRIM work for only Apple
SSDs.

#
# Original version by Grant Parnell is offline
(http://digitaldj.net/2011/07/21/trim-enabler-for-lion/)
#
# Looks for "Apple" string in HD kext, changes it to a wildcard match for
anything
#
# Alternative to http://www.groths.org/trim-enabler-3-0-released/
# Method behind this madness described:
http://forums.macrumors.com/showthread.php?t=1409151&page=4
# See discussion in comments here:
https://www.macupdate.com/app/mac/39654/lion-tweaks
# And here: http://forums.macrumors.com/showthread.php?t=1410459
# And here: http://forums.macrumors.com/showthread.php?t=1480302
sudo cp
/System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockSto
rage.kext/Contents/MacOS/IOAHCIBlockStorage
/System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockSto
rage.kext/Contents/MacOS/IOAHCIBlockStorage.original
# for Mavericks and Mountain Lion from 10.8.3 to 10.9.3

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/IOAHCIBlockSto
rage.kext/Contents/MacOS/IOAHCIBlockStorage
# for Mountain Lion from 10.8.1 to 10.8.2 and Lion 10.7.5
#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/IOAHCIBlockSt
orage.kext/Contents/MacOS/IOAHCIBlockStorage
# for Mountain Lion 10.8.0 and Lion 10.7.4 BELOW
#sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})
[^\x00]{9}(\x00{1,20}\x51)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|
sg'
/System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockSt
orage.kext/Contents/MacOS/IOAHCIBlockStorage
sudo touch /System/Library/Extensions/
# now reboot!

You might also like