Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tech4all

macrumors 68040
Original poster
Jun 13, 2004
3,399
489
NorCal
I have a Mac Pro (early 2008) running OS X Mavericks 10.9.5 in which I installed a 500GB Samsung 850 EVO using a 2.5" to 3.5" Icy Dock converter. I want to enable TRIM and tried using the Terminal method found here (the code to use doesn't fully show on the website, so the author provided this link which has all the code visible) and here. But after I reboot the computer, I go to verify under System Information that TRIM is enabled, but it always says, "TRIM Support: No" .

For reference, here's the different lines of code that are inputed into Terminal:

Backs up the file that will be patched. Don't think this is required though.
Code:
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

This is the code that patches the file and enables TRIM for Mavericks.
Code:
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

This forces a refresh of the system's kernel extension cache.
Code:
sudo touch /System/Library/Extensions/

Finally you reboot and it should work...but it doesn't...for me. Any ideas as to what the issue could be? I want to stick with Mavericks (as opposed to upgrading to Yosemite or El Capitan) for a number of reasons including that Adobe CS6, Illustrator in particular, doesn't seem to fully work with Yosemite.

Thanks! :)
 

KALLT

macrumors 603
Sep 23, 2008
5,380
3,415
Why do you want to enable it? You have a modern SSD with garbage collection and you are hacking kernel files to force the system to apply a mechanism that Apple intentionally disabled. Enabling TRIM on OS X seems to have very few benefits anyway. It doesn’t seem to be the case that OS X actually sends the TRIM signal asynchronously upon file deletion (I found no evidence to that end), but reserves this for complete file-system checks and disk/volume-erase operations, i.e. for some maintenance operations. Even then, you will not get the benefit while running from the main volume.

I used to enable TRIM on OS X, but now advise against it, even against the trimforce utility in Yosemite/El Capitan. Apple is including TRIM support in the Apple File System and specifically mentions asynchronous signalling as one of the improvements. This is where TRIM really shines.

Why did you go for some more or less shady websites? Why wouldn't you use something everyone uses because it works? https://www.cindori.org/software/trimenabler/

Report back after you have run the proper tool.

And what makes this the ‘proper’ tool? AFAIK, Trim Enabler used to apply the exact same hack.
 

tech4all

macrumors 68040
Original poster
Jun 13, 2004
3,399
489
NorCal
Thank you both for your replies.

Why did you go for some more or less shady websites? Why wouldn't you use something everyone uses because it works? https://www.cindori.org/software/trimenabler/

Report back after you have run the proper tool.

The code used on the first link was the same code used on the second link which is a thread from here. Seeing as the code was the same from two different sites (one being MacRumors forums), it seemed credible to me.

Yes, I have seen that software you linked to, but was hoping to accomplish the task without outside help. Nonetheless, I tried it and it did work as expected, thank you.

I can't recall where I read it at, but I assume you can uninstall Trim Enabler after you've enabled TRIM, correct? You don't need to keep it installed to keep TRIM enabled?

Why do you want to enable it? You have a modern SSD with garbage collection and you are hacking kernel files to force the system to apply a mechanism that Apple intentionally disabled. Enabling TRIM on OS X seems to have very few benefits anyway. It doesn’t seem to be the case that OS X actually sends the TRIM signal asynchronously upon file deletion (I found no evidence to that end), but reserves this for complete file-system checks and disk/volume-erase operations, i.e. for some maintenance operations. Even then, you will not get the benefit while running from the main volume.

I used to enable TRIM on OS X, but now advise against it, even against the trimforce utility in Yosemite/El Capitan. Apple is including TRIM support in the Apple File System and specifically mentions asynchronous signalling as one of the improvements. This is where TRIM really shines.

Thank you for the insight. I've read it was good to enable TRIM despite the fact that the SSD does have Garbage Collection; they seem to compliment each other. Course it does seem that there is some debate to this.

Some quick reference links:

https://www.cindori.org/trim-vs-garbage-collection/
http://arstechnica.com/gadgets/2015...garbage-collection-so-i-dont-need-trim-right/
Quick Google search for "TRIM vs garbage collection"

This blog (not sure how reputable that site's info is though) does seem to agree that TRIM isn't necessary on a Samsung 850 EVO.

With that said, does anyone have any further insight as to why the Terminal code method did not work? Or is it just one of those unknown reasons? :confused:o_O
 

KALLT

macrumors 603
Sep 23, 2008
5,380
3,415
Thank you for the insight. I've read it was good to enable TRIM despite the fact that the SSD does have Garbage Collection; they seem to compliment each other. Course it does seem that there is some debate to this.

Some quick reference links:

https://www.cindori.org/trim-vs-garbage-collection/
http://arstechnica.com/gadgets/2015...garbage-collection-so-i-dont-need-trim-right/
Quick Google search for "TRIM vs garbage collection"

This blog (not sure how reputable that site's info is though) does seem to agree that TRIM isn't necessary on a Samsung 850 EVO.

With that said, does anyone have any further insight as to why the Terminal code method did not work? Or is it just one of those unknown reasons? :confused:o_O

Note that these sources are about TRIM in general (i.e. include other operating systems). TRIM is a decent feature on its own if integrated completely, but I do not believe that Apple actually implemented it that way. Apple seems to be using TRIM as a maintenance feature only, which means that TRIM is not actually applied until you erase the disk (or volumes) or perform a file-system check. SSDs on Macs therefore benefit very little from TRIM in day-to-day operations (where TRIM matters) and that there are performance gains by activating it has not been convincingly proven. I do not think that there is a reason for using it in this case.

That said, what you are trying to do here is to rewrite a small part in a Mach-O binary within a kext (making the backup beforehand is definitely the right thing to do). I’ve had a quick look at it, and it turns out that the text-replace operation with perl does not even work. I assume that you are using an older version (and this is really not something you should be doing).

You can try this instead, but I do not take any responsibility for it.
Code:
cd /System/Library/Extensions/
cd IOAHCIFamily.kext/Contents/PlugIns/
cd IOAHCIBlockStorage.kext/Contents/MacOS/
exp='s,\000APPLE SSD\000,\000\000\000\000\000\000\000\000\000\000\000,sg'
sudo perl -pi.trimsave -e "$exp" IOAHCIBlockStorage
sudo touch /System/Library/Extensions

Then reboot.
 
Last edited:

hwojtek

macrumors 68020
Jan 26, 2008
2,274
1,277
Poznan, Poland
Nonetheless, I tried it and it did work as expected, thank you.
You're welcome.
And what makes this the ‘proper’ tool? AFAIK, Trim Enabler used to apply the exact same hack.
Yes. Basically the same. However it is a bit more functional and a bit less prone to typos.

I suspect a file privileges issue that Trim Enabler was able to correct before applying the patch.
 

tech4all

macrumors 68040
Original poster
Jun 13, 2004
3,399
489
NorCal
Note that these sources are about TRIM in general (i.e. include other operating systems). TRIM is a decent feature on its own if integrated completely, but I do not believe that Apple actually implemented it that way. Apple seems to be using TRIM as a maintenance feature only, which means that TRIM is not actually applied until you erase the disk (or volumes) or perform a file-system check. SSDs on Macs therefore benefit very little from TRIM in day-to-day operations (where TRIM matters) and that there are performance gains by activating it has not been convincingly proven. I do not think that there is a reason for using it in this case.

That said, what you are trying to do here is to rewrite a small part in a Mach-O binary within a kext (making the backup beforehand is definitely the right thing to do). I’ve had a quick look at it, and it turns out that the text-replace operation with perl does not even work. I assume that you are using an older version (and this is really not something you should be doing).

You can try this instead, but I do not take any responsibility for it.
Code:
cd /System/Library/Extensions/
cd IOAHCIFamily.kext/Contents/PlugIns/
cd IOAHCIBlockStorage.kext/Contents/MacOS/
exp='s,\000APPLE SSD\000,\000\000\000\000\000\000\000\000\000\000\000,sg'
sudo perl -pi.trimsave -e "$exp" IOAHCIBlockStorage
sudo touch /System/Library/Extensions

Then reboot.

Thank you for the further information, @KALLT. Fortunately this was just a "test" install of Mavericks. I'll just start fresh...reformat the SSD, reinstall Mavericks, and further test things out a bit more before I fully switch to the SSD. Probably play around with Trim Enabler more to get more familiar with it and decide whether or not to use TRIM. I'll definitely learn more about SSDs and TRIM. Even though my Mac Pro only has SATA II (3Gbps), I can't believe how fast boot times are, compared to a spinning hard drive.

You're welcome.

Yes. Basically the same. However it is a bit more functional and a bit less prone to typos.

I suspect a file privileges issue that Trim Enabler was able to correct before applying the patch.

Thanks for the possible explanation, @hwojtek and @KALLT, as to why the Terminal code may not have worked. :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.