Created
August 12, 2012 20:19
-
-
Save woods/3334193 to your computer and use it in GitHub Desktop.
Revisions
-
woods created this gist
Aug 12, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ #!/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!"