Created
August 12, 2012 20:19
-
-
Save woods/3334193 to your computer and use it in GitHub Desktop.
Enable TRIM support for 3rd Party SSDs. Works for Mountain Lion.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Enable TRIM support for 3rd Party SSDs. Works for Mountain Lion | |
# | |
# Source: http://digitaldj.net/2011/07/21/trim-enabler-for-lion/ | |
set -e | |
set -x | |
# Back up the file we're patching | |
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 | |
# Patch the file to enable TRIM support | |
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 | |
# Force a reboot of the system's kernel extension cache | |
sudo touch /System/Library/Extensions/ | |
echo "Now reboot!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Doesn't work on 10.8.2 Mountain Lion because this checks the whole string before the APPLE SSD to be nulled and the first character of the string after. In 10.8.2 the string after no longer is "Queue Depth", an additional SSD marker string "APPLE SSD TS" has been inserted so the first character after is "A" (\x41).
See my fork for a fix.