How To Add TRIM Support on your Mac SSD

It is possible to do this by hand using the Terminal. It looks ugly but essentially what you’re doing is patching a low-level system file to allow TRIM to function with your SSD.

Just to be on the safe side, back up the file we’re modifying. Copy the following into a new Terminal window and hit Return (the Enter key).

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

You’ll be prompted to enter your administrative password, so type it in and press Return once more.

Use the following command to modify the kernel extension so that it activates 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}\x54)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
Important: This code is intended for use on OS X Mountain Lion 10.8.5 or above or OS X Mavericks.

To make the changes take effect, you need to manually refresh the kernel extension cache.

sudo touch /System/Library/Extensions/

Once done, reboot and TRIM should be active.

Fixing Mac OS X Permissions from Terminal

I support a lot of Macs and it’s much easier to work on them remotely via SSH to do things like permission fixes, ACL repairs and other sneaky things. Here’s how to repair permissions from SSH/Terminal:

diskutil repairPermissions /

Of course you may need to sudo or use the su command to do this.

You can also do a repair disk this way too but that may dismount the users active drive so use with caution:

diskutil repairdisk /

 

Mac OS Log and Crash Report Locations for OS X 10.7, 10.8, 10.9

Within Mac OS X, crash reports are saved in various locations depending on which version of Mac OS X you have installed.

Since I work with 10.7.x and greater here are the ones I’m most interested in:

Mac OS X 10.7/10.8/10.9

In Mac OS X 10.7, 10.8, 10.9 crash logs are saved in the ‘Library’ folder which is hidden by default. To locate the Library folder, choose ‘Go to Folder’ from  Finder’s ‘Go’ menu and type:

~/Library/Logs/DiagnosticReports/

TIP: To make the Library folder permanently visible in Mac OS X 10.7/10.8/10.9, type the following command in Terminal:

chflags nohidden ~/Library

A look in there will look like this. Notice that Indesign has been a bad program lately:

Adobe Illustrator_2014-06-23-151424_NY05-0020.crash	
Adobe InDesign CS6_2014-07-03-193002_NY05-0020.crash	
Adobe InDesign CS6_2014-07-04-162801_NY05-0020.crash
Adobe InDesign CS6_2014-06-23-170943_NY05-0020.crash	
Adobe InDesign CS6_2014-07-03-193036_NY05-0020.crash	
Adobe InDesign CS6_2014-07-04-162943_NY05-0020.crash
Adobe InDesign CS6_2014-07-03-154725_NY05-0020.crash	
Adobe InDesign CS6_2014-07-03-193510_NY05-0020.crash	
Adobe InDesign CS6_2014-07-04-163221_NY05-0020.crash
Adobe InDesign CS6_2014-07-03-155019_NY05-0020.crash	
Adobe InDesign CS6_2014-07-03-193829_NY05-0020.crash	
Adobe InDesign CS6_2014-07-04-163312_NY05-0020.crash
Adobe InDesign CS6_2014-07-03-155534_NY05-0020.crash
Google Chrome Helper_2014-06-07-094200_NY05-0020.crash

If you’re logged on from SSH and you’re not the user in question you can use sudo to see the users logs, just use the path below with the user name:

~/Users/username/Library/Logs/DiagnosticReports

Happy troubleshooting!