Jul 24, 2011

TRIM enable for SSD's other than apples in LION

So TRIM? What the hell is that? Well, it's a technology that enables the operating system in a computer to keep the SSD (instead of a hard-drive) working fast an efficient by cleaning up the mess once in a while ... automatically. I know that makes little sense, but over time SSD's will turn slower and slower, unless the operating system supports TRIM which is like having a cleaning lady tidying up the order of things.

Unfortunately, unless your mac originally came with an SSD the new version of Mac OS X (Lion) will not support that, unless you do the following.

1. Open the terminal and backup some files first:

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

2. Patch some files to add support for TRIM

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

3. Clear the caches (two lines, each with a return)

sudo kextcache -system-prelinked-kernel

sudo kextcache -system-caches

4. Then reboot to see changes take effect.



If you wanna disable it again:

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

sudo kextcache -system-prelinked-kernel

sudo kextcache -system-caches


And if you want to revert to your backup:

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



Original post found here: http://digitaldj.net/2011/07/21/trim-enabler-for-lion/