In OS X Lion how do you enable TRIM support for SSDs?
Right now Apple's TRIM support seems to be limited only to Apple SSDs, though. I am running an Intel X-25M (G2, or second-gen) SSD in my MacBook Pro, and this SSD does support TRIM, however there's no apparent way to enable it in Lion. Anyone have pointers on this?
See also: www.macrumors.com/2011/06/27/mac-os-x-10-6-8-bring...
Instead, you can run the following Terminal commands:
So, here's the proper way to enable TRIM support. Copy these commands out, find/delete all "[REMOVE ME]" placeholders so the commands are contiguous, and run them in Terminal:
→ Backup the file we're patching:
sudo cp /System/Library/Extensions/IOAHCIFamily.[REMOVE ME]kext/Contents/PlugIns/IOAHCIBlockStorage[REMOVE ME].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[REMOVE ME]\x6C\x00).{9}(\x00\x51)|$1\x00\x00\x00\[REMOVE ME]x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.[REMOVE ME]kext/Contents/PlugIns/IOAHCIBlockStorage[REMOVE ME].kext/Contents/MacOS/IOAHCIBlockStorage
→ Clear the kext caches
sudo kextcache -system-prelinked-kernel
sudo kextcache -system-caches
→ Now, Reboot!
→ If in the future you want to disable TRIM support:
sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61[REMOVE ME]\x6C\x00).{9}(\x00\x51)|$1\x41\x50\x50\[REMOVE ME]x4C\x45\x20\x53\x53\x44$2|sg' /System/Library/Extensions/IOAHCIFamily.[REMOVE ME]kext/Contents/PlugIns/IOAHCIBlockStorage[REMOVE ME].kext/Contents/MacOS/IOAHCIBlockStorage
→ Or if something goes horribly wrong, restore the backup:
sudo cp /IOAHCIBlockStorage.original /System/Library/Extensions/IOAHCIFamily.[REMOVE ME]kext/Contents/PlugIns/IOAHCIBlockStorage[REMOVE ME].kext/Contents/MacOS/IOAHCIBlockStorage
All the patch does is edit the IOAHCIBlockStoage file, patching out the string "APPLE SSD" to zeros. This happens to enable TRIM support for all SSDs.
Please visit my post about these Terminal commands here: digitaldj.net/2011/07/21/trim-enabler-for-lion/
41 people like this answer
Clicking the mark as good answer button helps us highlight the best answers.
groths.org/?p=308
groths.org/zeus/TRIMEnabler.zip
I have NOT tested this, and have no idea if it's going to blow anything up in Snow Leopard, Lion, or otherwise.
Lifehacker also wrote a pretty good looking guide here: lifehacker.com/5803331/how-to-enable-trim-on-your-...
Has anyone had any luck with it thus far?
4 people like this answer
I foolishly forgot to make a back up with the Trim Enabler app and now after reading this, I'm starting to get worried. What should I do?
Capacity: 180,05 GB (180.045.766.656 bytes)
Model: OCZ-VERTEX2
Revision: 1,280000
...
TRIM Support: Yes
2 people like this answer
1 person likes this answer
0 people like this answer
INTEL SSDSA2M160G2GC:
Capacity: 160.04 GB (160,041,885,696 bytes)
Model: INTEL SSDSA2M160G2GC
Revision: 2CV102HD
...
TRIM Support: No
...
maybe some caching is involved?
0 people like this answer
Cheers,
0 people like this answer
0 people like this answer
0 people like this answer
0 people like this answer
-bash: syntax error near unexpected token `.{9}'
0 people like this answer
share:
Related questions
35 users following this question:
This question has been viewed 26002 times.
Last activity .
Tips for giving the best answers
Sometimes it's just little details that separates a great and not so great answer! Here are a few simple tips to keep in mind:
- 1
- Be complete and thorough. Don't skimp on the details!
- 2
- Try not to answer with a question. Because that's not really an answer, right?
- 3
- A little research goes a long way. Back up your claims and assumptions!
- 4
- Try to be patient, tech questions can be complicated.
- 5
- You are awesome for both reading this and answering questions.





