Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Enable TRIM in OS X 10.7.5 to 10.9.5

Enable TRIM on non-Apple SSDs in OS X

NOTE: This is tested on the versions mentioned in the title, and NOT earlier or later versions. YMMV.

Run the following commands in Terminal…

Backup the original driver:

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-backup

Modify the driver (choose only one of the following lines, based on the version):

# 10.9.4 & 10.9.5
sudo perl -pi -e 's|(^\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

# 10.8.3 to 10.9.3
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

# 10.7.5, 10.8.1, 10.8.2
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

Run these commands in succession to clear the system caches to enable OS X to pick up the modified driver:

sudo kextcache -system-prelinked-kernel
sudo kextcache -system-caches
sudo touch /System/Library/Extensions/

Restart the Mac.

Copy link

xplainit commented Sep 5, 2014

OSX 10.7.5 build 11G63.
Trim ENABLED. Thanks a lot !!!

Copy link

bizulk commented Nov 3, 2014

MBP With OS X 10.9.5 (13F34)
==> WORKED 😄
Question : How did you find out ?

Copy link

dwueppel commented Apr 30, 2015

Worked in MBP with OSC 10.8.5

Copy link

OldBaldGit commented May 12, 2015

MacBook 2.1 2007 upgraded Tiger --> Snow Leopard --> Lion 10.7.5

It worked like a charm first time!

Thank you!!!!!!!!

Copy link

Bammonb commented Jul 21, 2015

Hello All,

Thanks for taking the time to post this information.

Unfortunately I feel that enabling TRIM on my Kingston SSD has slowed it down.

It did enable TRIM successfully.

What is the best course of action to reverse these changes?

I am running MAC OSX 10.9.5

Do I need to go to Genius bar and have them drop a new Image on the HD?



Copy link

fefone commented Dec 26, 2015

successfully enabled TRIM on MacBookPro6,2 - OS X 10.8.5 (12F2560) for a Samsung 850PRO.
Thanks a lot!

Copy link

ccastillo commented Jun 12, 2016

Thank you. This help me with a MacBook late 2007 model running OS X Lion on Patriot Pyro SSD.


Copy link

Atalantia commented Sep 20, 2016

Thank you it works like a charm on a 10.9.5 But if System Information says Trimm is on. Is it really on? How can I see that this is on. And by the way what does it? Randomly change the Memory Location of every bit?

Copy link

RJVB commented Apr 21, 2020

Exactly where am I supposed to see the trim enabled indicator on OS X 10.9.5?

I think I've applied the correct patch from the list above but I cannot seem to find the indicator for my external Kingston SUV500MS120G (SSDNow family).

> md5sum /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/*
79f51aaf114f3dd8be5e409f6e3c13df  /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
ef72c0c2bfb1074bf400d3405efdae10  /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage-backup

> kextstat | fgrep -i IOAHCIBlockStorage
   61    0 0xffffff7f813bb000 0x18000    0x18000 (2.6.0) <43 16 6 5 4 3 1>

contents comparison, does this look correct?

> od -x IOAHCIBlockStorage-backup > /tmp/kk1
> od -x IOAHCIBlockStorage > /tmp/kk2
> diff tmp/kk[12]
< 0201720      0a79    4100    5050    454c    5320    4453    5400    6d69
> 0201720      0a79    0000    0000    0000    0000    0000    5400    6d69

EDIT: I just realised this patch replaces the string "APPLE SSD" with as many null bytes. I see a second occurrence of a very similar pattern a bit further in the file: "APPLE SSD TS". I guess I have nothing to lose to replace that one too (would I have an older version of the framework on my system?!)

Copy link

clarencesong commented Apr 26, 2020

@RJVB You should be able to see it in System → Hardware → SATA → Trim Support: Yes

Copy link

RJVB commented Apr 26, 2020

Copy link

clarencesong commented Apr 26, 2020

@RJVB I've only tested this on SATA SSDs, as this was the only way to get TRIM back in the day. (Later versions of OS X supported the trimforce command.) Sorry, I don't know of a way to check if TRIM is actually working at a lower level.

Copy link

RJVB commented Apr 26, 2020

Copy link

PhshPhan commented Apr 22, 2021

Thanks man. Worked on my evo860 SSD on my mid-2012 i5 on OSX 10.9.5 after the initial software update following reinstallation of OS X.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment