четверг, 25 апреля 2013 г.

Enable TRIM on OSX


The first step makes a backup of the original IOAHCIBlockStorage file called IOAHCIBlockStorage.original. You will be prompted to enter in your system password when using the "sudo" command, since you are modifying system files. Copy and paste the code into the terminal window, a successful or uneventful response is a new blank terminal line.
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
Next the code patches the IOAHCIBlockStorage file, removing the requirements that the SSD be made by Apple. Copy and paste this code just like the previous command, this step should complete in very little time (seconds or less than a second).
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
The last step loads the newly patched file into the kernel. On a few systems this particular command takes a bit to complete. Expect to see the terminal window wait for 10-15 seconds before a new line appears.
sudo kextcache -system-prelinked-kernel
sudo kextcache -system-caches
Now reboot your system and verify that TRIM is enabled through the System Information on the Serial-ATA device listing. As you can see on the system we performed this modification on, TRIM support is now enabled.
If you want to disable TRIM or completely reverse any changes performed with this guide, two options are available.
The first reverses the changes.
sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00).{9}(\x00\x51)|$1\x41\x50\x50\x4C\x45\x20\x53\x53\x44$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
sudo kextcache -system-prelinked-kernel
sudo kextcache -system-caches
The second utilizes the backup file created and restores it over the modified one.
sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.original /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
Overall the process to enable TRIM on an OSX Lion system is rather painless, with the only requirement being that a SSD that supports TRIM is installed. If you happened to update your notebook or desktop to an SSD, enabling TRIM is a must for the best long term sustained performance.

© http://www.storagereview.com/how_to_enable_trim_with_nonapple_ssd ©

среда, 17 апреля 2013 г.

OSX: Cleanup "open with..."

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user