Skip to content

Instantly share code, notes, and snippets.

@philip-goh
Created October 13, 2012 18:37
Show Gist options
  • Save philip-goh/3885700 to your computer and use it in GitHub Desktop.
Save philip-goh/3885700 to your computer and use it in GitHub Desktop.
Enable trim on Mountain Lion
#!/bin/bash
#This script is based on the instructions presented on:
#http://digitaldj.net/2011/07/21/trim-enabler-for-lion/
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
sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x4D)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
sudo touch /System/Library/Extensions/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment