| # | |
| # UPDATE for 10.10.4+: please consider this patch obsolete, as apple provides a tool called "trimforce" to enable trim support for 3rd party SSDs | |
| # just run "sudo trimforce enable" to activate the trim support from now on! | |
| # | |
| # Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/) | |
| # Update July 2014: no longer offline, see https://digitaldj.net/blog/2011/11/17/trim-enabler-for-os-x-lion-mountain-lion-mavericks/ | |
| # | |
| # Looks for "Apple" string in HD kext, changes it to a wildcard match for anything | |
| # | |
| # Alternative to http://www.groths.org/trim-enabler-3-0-released/ | |
| # Method behind this madness described: http://forums.macrumors.com/showthread.php?t=1409151&page=4 | |
| # See discussion in comments here: https://www.macupdate.com/app/mac/39654/lion-tweaks | |
| # And here: http://forums.macrumors.com/showthread.php?t=1410459 | |
| # And here: http://forums.macrumors.com/showthread.php?t=1480302 | |
| # | |
| # Yosemite: for recovering from stop sign on boot screen, please see http://www.cindori.org/update-on-trim-in-yosemite/ | |
| # backup patched file | |
| 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 | |
| # Important: Add "kext-dev-mode=1" as Kernel Arguments or the computer won't boot. | |
| sudo nvram boot-args="kext-dev-mode=1" | |
| sudo shutdown -r now | |
| # looks for "Apple" string in HD kext, changes it to a wildcard match for anything | |
| sudo perl -pi -e 's|\x00\x41\x50\x50\x4c\x45\x20\x53\x53\x44\x00|\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage | |
| # rebuild kext cache manually (could take a while) | |
| sudo touch /System/Library/Extensions | |
| sudo kextcache -m /System/Library/Caches/com.apple.kext.caches/Startup/Extensions.mkext /System/Library/Extensions | |
| # now reboot! | |
| sudo shutdown -r now |
Any idea if 10.8.5 will break TRIM? I'm a bit afraid to update.
Excellent, thanks!
Is there a reason you omit the two lines which will clear the cache?
sudo kextcache -system-prelinked-kernel
sudo kextcache -system-caches
Confirmed. Works with 10.8.5.
Thank you. Confirmed working on 10.8.4 with Samsung SSD 840 Series
Thanks a Lot. (Working on 10.8.5 with OCZ Vector)
hi,
thanks for this script. I had success on Mac mini (10.8.5) with it, but seems not working on my hacintosh 10.9GM (OCZ-VERTEX3).
Hi,
I am also using OCZ-VERTEX3. Suddenly today, after nothing more than a reboot, my mac refused to boot and went to the "no entry" grey screen. I did a verbose boot (alt-command v), and got a repeating error message saying "still waiting for root device".
I traced this error message to "IOAHCIBlockStorage.kext". After running the perl command, and rebooting, my macbook is up and running again. Thanks a lot
Can more people please confirm if this does work on 10.9 GM?
Anyone tried it on Mavericks (10.9)?
Tried script for Mountain Lion 10.8.3 - 10.8.5 on 10.9
it works!
Works with 10.9 with SanDisk UltraPlus 256G aka SanDisk SDSSDH2256G
Works great! Thank you!
10.9.2 md313 KINGSTON SV300S37A120G
10.9.2 OCZ-VECTOR Works, thanks!
Confirmed. Works on 10.9.2 with Samsung SSD 840 Pro Series
Confirmed works with 10.9.2 with Crucial M550 1TB SSD. :)
Works with 10.9.3 with Samsung 830 256Gb
THANKS!!!
Works with 10.9.3 with M4-CT512M4SSD2 512GB
not working anymore with 10.9.4 please provide an update
Confirmed for 10.9.4 with a Plextor 256GB M6e. Thanks!!!!
Confirmed for 10.9.4, KINGSTON SV300S37A120G Thanks!
Works for 10.9.4, MacBookPro5,5, OCZ-AGILITY3 (setup as a Fusion drive with a WDC WD10JPVX).
Samsung 840 PRO
Confirmed: 10.9.4, 10.9.5, 10.10, 10.10.1, 10.10.2
10.10.3: See @andrewpsy
Confirmed for 10.9.4 KINGSTON SV300S37A240G
Confirming OS X 10.9.4 Samsung 840 EVO
I can add that this works also on 10.10 DP4, the previous version worked until DP2, it seems that 10.9.4 and 10.10 DP3+ share the same SSD driver :)
Confirmed working for OS X 10.9.4 PLEXTOR PX-512M6Pro (rev 1.01)
Beware: after 3 days of steady use I encountering random beach balling, culminating in losing the boot sector. I wasn't able to restore the boot partition or repair the disk. Similar reports on the plextor user forum.
Confirmed for 10.9.4, Samsung 840 EVO
Confirmed for 10.9.5 13F24, Samsung 850 PRO 1TB running on MacMini 3,1
Confirmed for 10.9.5 (13F34), Samsung 840 PRO 256 GB on MacPro4,1
Also confirmed for OS X 10.9.5 (13F34), PLEXTOR PX-256M5Pro (rev 1,06) on Macmini6,2
Confirmed for 10.9.5 (13F34), Kingston SV300S37A120G, MacbookPro5,5
Works macbook5.1 (late 2008) with OS X 10.9.5, 8GB RAM, Samsung SSD 840 EVO. Also shows
Link Speed: 3 Gigabit
Negotiated Link Speed: 3 Gigabit
SUPERB!
Thank you!
Confirmed for 10.9.5, Crucial_CT512MX100SSD1, MacBook Pro late 2011
Doesn't work with 10.9.5 & 256GB Samsung 850 Pro SSD. Takes all command, gives no error but no TRIM support after reboot. I have SSD connected on MacPro 5,1 (beneth the Superdrive, not into HD socket due to missing adapter). What can be wrong - SATA cable not the same as SATA socket or something about the software?
Thanks, you‘re good man。
For Yosemite you have to disable driver signature check
sudo nvram boot-args="kext-dev-mode=1"
http://www.cindori.org/enabling-trim-on-os-x-yosemite/
This will break Yosemite final release so please don't use it.
Perhaps you need to rebuild kext cache?
# rebuild kext cache
sudo kextcache -prelinked-kernel /System/Library/Caches/com.apple.kext.cache/Startup/kernelcache -K /System/Library/Kernels/kernel /System/Library/Extensions
Any idea how to fix now that my computer won't boot correctly?
Update: disk repair won't fix this. I had to reinstall Yosemite from my boot partition.
Someone should try this guy's version to see if that works: https://gist.github.com/rizal72/0f738cc6735744f84bb3
I've already done my good deed for today.
no, it still works. if you get stuck on reboot, please use this instructions, skipping the Trim Enabler Part: http://www.cindori.org/enabling-trim-on-os-x-yosemite/
updated instructions for yosemite to prevent the boot screen lock according to http://www.cindori.org/enabling-trim-on-os-x-yosemite/
OSX 10.10
Crucial m4 ct256m4ssd2
TRIM Support: Yes
Thanks!
Confirmed for OS X 10.10 ( MacBook Pro 13-inch, 2012 mid )
PLEXTOR PX-128M5S
Trim Support: Yes
Thanks a million
Thanks, your revised instructions worked with Yosemite.
osx 10.10
mac book mid 2009
all instructions entered
got the message: kext-dev-mode allowing invalid signature -67061 ....
nevertheless: trim seems to work
thanks
Worked for me.
osx 10.10
mac book mid 2010
ocz ssd
Trim works. Thanks!
Works on my Late 2011 Macbook Pro 13 with 10.10 with Samsung SSD 840 EVO 750GB
i still get Trim enabler: No after run the script. What happened? i have a KINGSTON SV300S37A120G
@kike1 The commands after the first shutdown command are never executed. Somebody should probably change the name of the Gist. Anyway, just copy and paste the commands one by one.
Thank you! Works on Yosemite 10.10.1
Thank you very much! It works perfectly: Crucial M4 (firmware 070H) + Yesomite 10.10.1 :)
Confirmed for OS X 10.10.1 ( MacBook Pro 13-inch, 2012 mid )
PLEXTOR PX-128M5S
Trim Support: Yes
Thanks a million
Doesn't work for me - 2009 MacBook Pro + 120GB SanDisk Extreme...
Work perfectly for 10.10 clean install, then stuck with white circle grey background while update to 10.10.1. But its working after recovering and re enable. (Samsung 840pro 256Gb - MBP 15" early 2011).
This worked for me on MacBook (13-inch, Mid 2010) with 240G Intel 530 Series at 10.10.1 clean environment.
I just did it on OS X Yosemite 10.10.1 on a clean install. Worked like a charm.
Thanks! Seems to work on Yosemite for me on my Kingston V300.
Still working with 10.10.2 Public Beta.
How do I disable TRIM on 10.9 before upgrading to 10.10?
Funny, I didn't work on my Yosemite 10.10.1.
Any extra steps you guys above took?
PS: In any case I downloaded Trim Enabler but I am curious to understand why this didn't work.
Confirmed for 10.10.1 and Samsung SSD 850 PRO. Thanks!
Works like a charm with 10.10.1 and a fusion drive setup with an Intel 330 120GB and a stock 1TB HDD.
Works perfect on 10.10.2, but after the update you need to turn it on again.
Thanks. This works perfect on Yosemite with Crucial MX100 256 GB in a 2012 Macbook pro.
Worked for me. Samsung 850 EVO 500GB on mid 2012 MacBook Pro with Yosemite 10.10.2 and Samsung EVO 250GB on 2011 MacBook Pro with Yosemite 10.10.2.
I also wrote a tool called TRIMCheck that verifies TRIM is enabled on your SSD drives at each boot and shows a warning message if it is not. This is intended to remind you to rerun the steps in this gist in case an OS X update has updated the kext driver patched by these instructions.
The shell script works well on Mavericks 10.9.5.
An additional tip regarding TRIM using Yosemite:
- Prepare a Mavericks boot drive using Disk Utility (USB stick / old USB HDD should do)
- Boot to this drive and modify using the shell script above
- After rebooting to this drive verify that all 3rd party SSD drives in the system show "TRIM Support: Yes" (About this mac -> More Info -> System report -> SATA/SATA Express -> {your SSD drive} )
- Boot every once in awhile to this drive (e.g. once a week) and run Disk utility choosing "Repair Disk" on your third party SSD.
- Observe occurrence of prompt message "Trim unused space"
This way you won't have to mess with the kext signing still preventing write amplification.
Please note: That worked for me on a Samsung 840. Maybe some SSD drives fail on the OS's TRIM command. So, please use at your own risk and better yet, make a backup prior to your first attempt.
It did not work for me with my X25-E Intel SSD drive. (Yosemite 10.10.2, MacBook Pro, Late 2008). I tried it several times but I still get TRIM Support: No in the System Report. The Internets are controversial about why is that: some write that the SLC based SSD drives do not need TRIM, some argue.
The script works fine on a Yosemite Macbook Pro with Samsung 840 Pro SSD. However, I understand that if I upgrade to a newer revision of Yosemite in the future, the kext signing may be switched on again by the upgrade, which will mean I won't be able to boot the computer (as TRIM is set to on).
I'm very new to all of this so what are the steps for disabling TRIM before any upgrades, please?
Thank you!!!
This is so cool. Samsung SSD 840 PRO Series says:
TRIM Support: Yes
Thanks!
If I used the SDD for long without TRIM enabled and apply this script, does OSX zero out all pages that are currently filled up with deleted file data on the SSD retroactively?
@Bialykot What happens after a kernel upgrade is that Yosemite turns TRIM off. You'll be able to boot but TRIM is deactivated and you need to apply the procedure again. Of course, there's no guarantee here...
I had automatic upgrades switched off and always check this site before upgrading.
hfoffani - thanks for that. I've just installed the latest security patch to Yosemite 10.10.2 and all went OK and TRIM was still enabled after the update. BUT ... what if there is a more major patch/upgrade to Yosemite - e.g. to 10.11? would I have to disable TRIM before applying the upgrade? And if so, what are the exact steps / script to do this? Sorry if the questions seem a bit naive. Just want to be as sure as I can not to mess up my BBP. (I do have a full backup but this takes several hours).
BTW - the TRIM really works well on my Samsung 840 pro. Without TRIM I was getting 50-100Mb/s write speeds but with it activated I always get around 500Mb/s. :)
Bialykot. No, you don't need to anything. After upgrading, you'll see that TRIM is unsupported again so you have to apply this patch (or the corresponding one) again. That's why many of us had switched off OS X autoupdates. It's better to check this site before upgrading in case some incompatibilities appears in a future version.
Thank you for that, it works for me
- Yosemite version 10.10.2 (14C1510) and
- SSD Kingston SVP100S512G
by the way, I have 2 SSD in my macbook pro 17inch
- original Apple SSD 128Gb with OSX on it
- additional SSD 521Gb for data and virtual machines at the place of the superdrive.
I expect that OSX update will not affect the original SSD, but will may be affect the additional SSD
I do not know how it will happens, but I suppose I will be able to patch again the
sudo nvram boot-args="kext-dev-mode=1" and the reboot to get back to my data SSD
Thank you! 10.10.2 and Samsung SSD 840 EVO work great.
It doesn't appear to be working after the 10.10.3 update. After running the perl line the driver is unchanged, so it seems that we'll need a new pattern to search for.
Same result as rbfinch, the perl reg-exp magic does nothing on 10.10.3
replace the perl command with this one worked for me:
sudo perl -pi -e 's|\x00\x41\x50\x50\x4c\x45\x20\x53\x53\x44\x00|\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
source http://www.insanelymac.com/forum/topic/298507-enable-trim-on-non-apple-ssd/
Thanks andrewpsy, you saved my day;). The new perl script line worked for me as well.
updated for 10.10.3, thanks @andrewpsy
Thanks, worked like a charm
Thank you!
mid-2012 10.10.3 + Samsung Evo 850 500Gb - worked fine!
working great with late 2009 unibody macbook + 10.10.3 + OCZ Agitility 3
Thank you, works great with my 2010 macbook pro + Corsair SSD.
My question is how do you disable before system update?
How can I revert back or disable it because I have a new update which fixes graphics for my iMac? Please help.
Thank you very much, this works very well on a Macpro 2013 with four Samsung 840 EVO in an Akitio Thunder2Quad case (which is a Thunderbolt 2 case with four SATA Slots, the drives are configured as a RAID 1+0 in OSX 10.10.3)
I am very happy this works, because for my setup here, there isn't even any solution by Apple that I could get instead. First they promote the Macpro with all these great, super fast Thunderbolt connections, and then they deactivate TRIM for basically all SSDs connected by Thunderbolt... thanks again, Apple! (sarcastically!)
@francisceril: You don't have to for such a small update. It's not a complete OS update you are mentioning...
This script still works in 10.10.4 public beta (10.10.4 (14E11f)).
confirmed. It works on 10.10.3
容量: 256.06 GB(256,060,514,304 字节)
型号: PLEXTOR PX-256M6S
修正版: 1.070000
序列号: P02431100565
原生命令队列: 是
队列深度: 32
活动盘片: 否
可拆卸的驱动器: 否
BSD 名称: disk0
介质类型: 固态
TRIM 支持: 是
This script still works under public beta 10.10.4 (14E17e).
MacBook Pro 6,1 (17' Mid-2010), 10.10.3, Samsung 850 pro 1T = Ok!
Thank you.
MacBook Pro (13-inch, Early 2011), 10.10.3, KINGSTON SV300S37A240G
Works !
MacBook Pro (13-inch, Mid 2012), 10.10.3, Samsung SSD 840 EVO 250GB
Works perfectly
This script still works under public beta 10.10.4 (14E26a).
I wonder if it even is necessary to keep kext-dev-mode enabled? I just booted without it, but still having trim enabled (10.10.3).

Of course, if somehow the kernel caches get regenerated, the patched extension will be skipped and you can't boot (you have to repair from recovery partition or USB/DVD as explained here).
By the way: kextcache doesn't directly check the NVRAM value, but the sysctl settings of kern.bootargs (see function isDevMode() at http://www.opensource.apple.com/source/kext_tools/kext_tools-384.1.4/security.c). Unfortunately, the sysctl value is still read-only and can only be set on boot time via NVRAM.
Worked for me with OS X 10.10.3 on macbook pro mid 2009, SSD Corsair Neutron.
How to use this script from windows or MAC?
@khpatel4991 You'd have to enter those commands in Mac OS X Terminal (in Applications - Utilities). If this is too complicated for you, you're better off using https://www.cindori.org/software/trimenabler/.
This script still works under public beta 10.10.4 (14E33b)
I just read the happy news that in OSX El Capitan, there will probably be an official OSX-tool named Trimforce, which enables TRIM for all SSDs if the user chooses to do so. Without having to deactivate the kext-signing, that is!
http://9to5mac.com/2015/06/12/os-x-ssd-trim-support-el-capitan/
I really hope this is true, it would prove that Apple is still able to make sane decisions and listen to their users!
This script still works under public beta10.10.4 (14E36b)
OCZ-AGILITY3 10.10.3
OK!
thanks!
MacBook Pro (15-inch, Late 2011), 10.10.3, Crucial CT500MX200SSD1
It works! Thanks!
With the new 10.10.4 trimforce now enabled, do we still need this?
I think it's just a matter of running sudo trimforce enable in your terminal right?
@TechFounder: Confirmed. This patch is no longer required.
@TechFounder @ralfbergs This is great news. Thanks for sharing!
BTW: Make sure you undo the changes the script made after updating to 10.10.4. Something like:
sudo rm /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.original
sudo nvram -d boot-args
# Not sure if these are really necessary
sudo touch /System/Library/Extensions
sudo kextcache -m /System/Library/Caches/com.apple.kext.caches/Startup/Extensions.mkext /System/Library/Extensions
# Reboot and run `sudo trimforce enable`sudo trimforce enable
Yesterday, Apple had released OS X 10.10.4, including on it the new remarkable trimforce tool which allow native TRIM support for 3rd parties SSDs. This is a huge win for the Mac users community because the people had ask for this a while ago. I believe that Apple had made this decision because after the release of OS X Yosemite, which includes the new kext signing feature, Mac users were disabling this security feature, which when turned off, allows to execute arbitrary code in modified kext extension natively, WHICH was an huge security flaw. This been said, I guess Apple would rather prefer to allow their Macs to support 3rd parties SSDs and have Macs secured, than have a lot of hacked Macs and all the internet taking about it...
Although, old Macs are getting obsolete due to the absence of current technologies, most of the regular users still can extract a bit more juice of their Macs, so they will find this tool very useful. As for power users, I recommend just buying a new Mac...
"sudo trimforce enable" didn't work for me on 10.10.4. Still had to use the script to change the driver signature and disable security checks :(
I got some issue when disabling the changes done by this script and booted to the STOP sign screen after using sudo trim force enable, one of the crucial thing I missed when disabling the patched driver is I did not remove the patched driver file in "/Volumes/Your Disk Name", seems the guide in the link is good enough for me to fix https://www.cindori.org/trim-enabler-and-yosemite/, though I did mistyped chown/chmod lucky no permanent damage is done anyway, after all the mess I did at least it is working for the TRIM without a patched driver under 10.10.4!
Used this script, even for 10.10.4, always perfect, thanks
but it no longer works with 10.10.5 :-(
Anyone tried with El Capitan 10.11 yet? I'm getting an Operation not permitted error when trying to make the backup of the driver in the first step.
New Solution worked for me on OS X El Capitan 10.11.2 Beta (15X40a)
KINGSTON SV300S37A
Confirmed, in my case a 240G (KINGSTON SV300S37A240G)
by: sudo trimforce enable
Mac OS X: 10.11.5
Thank you