-
-
Save sames/4754430 to your computer and use it in GitHub Desktop.
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 characters
#!/bin/bash | |
# | |
# Enable TRIM support for 3rd Party SSDs. Works for Mountain Lion, should work on earlier OSes too. | |
# Tested on 10.8.2, checked for proper operation on 10.8.0, but never booted with the modified kext. | |
# | |
# Original 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 | |
# This nulls out the string "APPLE SSD" so that string compares will always pass. | |
# on 10.8.2, the sequence is Rotational\0APPLE SSD\0MacBook5,1\0 | |
# on 10.8.0, the sequence is Rotational\0\0APPLE SSD\0\0\0Queue Depth\0 | |
# The APPLE SSD is to be replaced with a list of nulls of equal length (9). | |
sudo perl -pi -e 's|(Rotational\x00{1,20})APPLE SSD(\x00{1,20}[QM])|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|' \ | |
/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
I updated my version to support 10.8.3 and also to add some instructions.