Did you just buy an SSD for your MAC running Lion and would like to get the best of it?
A short explanation:
In normal hard disks when a file or directory is been erased, in fact the space used by the file or directory is simply put back on the unused space list. Nothing is really been erased at all. That is why sensitive information should always be overwritten by something instead of simply erased… but that is another subject.
So the space that is been made available again will soon or later be used again as we would expect. When it is used again the new data will overwrite the old one. That is where SSDs and rotating hard disks differ. With rotating hard disks, the new data is simply written in the available space without having to erase the old one before. In SSDs the technology demands that the old data be first erased before new data will be written, which slows down the writing time. This means with time the writing speed of SSDs starts to slow down drastically. This is where the TRIM function of a system comes in play. The TRIM function regularly deletes the unused space on SSDs while the CPU/IOs are not too busy. This saves a lot of writing time, therefore keeps the high writing speed of SSDs up to their maximum throughout the life of the SSD.
Well here comes the bad news for MAC Lion owners … and the the good ones afterwards 🙂
The BAD NEWS:
Apple has restricted the TRIM function only to the Apple identified SSDs. Therefore all non-Apple SSDs don’t get the feature. Nasty hunn??
The GOOD NEWS:
Some very talented and generous guys have found a way to modify the kernel module of MAC Lion (till 10.7.4 but not on 10.7.5)in order to enable the TRIM function for all SSDs and not only Apple ones. .. and here is how it is done:
References:
http://bytelude.de/2011/10/13/ssd-trim-support-unter-mac-osx-lion-aktivieren/
http://digitaldj.net/2011/07/21/trim-enabler-for-lion/
INSTRUCTIONS:
Make a copy of the original kernel module:
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
Modify the kernel module:
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/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
Do some system preparation
sudo kextcache -system-prelinked-kernel
sudo kextcache -system-caches
Reboot the system .. and cross your fingers 😉
Check the the activation of the TRIM feature:
– Open up ‘About This Mac’
– Click the “More Info…” button and then the “System Report” button.
– In the list on the left, choose “Serial-ATA”.
– Click on your SSD Drive and in the lower half of the screen you should now see “TRIM Support: Yes” instead of “No”.
If something terribly goes wrong then restore the 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
sudo kextcache -system-prelinked-kernel
sudo kextcache -system-caches
sudo reboot
NOTE 1:
I have installed a 512 GB Samsung Series 830 on my MAC Book Pro i7, followed these instructions and all worked without a glitch. I’m very thankful to the people who have worked to discover this modification and made it available to us.
Note 2 (30.09.2012):
I just updated my OS X from 10.7.4 to 10.7.5, especially because of WiFi instability, and found my TRIM support going from ‘Yes’ to ‘No’.
Well, that was rather expected, but the unexpected thing was that the above method with the terminal commands this time didn’t work.
I found in Internet an application that does the trick though even in 10.7.5. Easy to use and you need to reboot afterwards.
It’s called App Trim Enabler found at: http://www.macupdate.com/app/mac/37852/trim-enabler
Note 3 (20.06.2013:
Just got the news of another TRIM tool called Cameleon SSD Optimizer. I haven’t tried it yet but seems promising. You can get it at:
http://chameleon.alessandroboschini.it/index.php
Happy ‘Trimming’