Contribute
Register

I have a trim ! (Yes, i boot SSD)

Status
Not open for further replies.
Joined
Mar 31, 2012
Messages
29
Motherboard
Gigabyte Z390 Designare
CPU
i9-9900k 3.6 Mhz
Graphics
Radeon RX Vega 56
Mac
  1. MacBook
  2. MacBook Pro
  3. Mac mini
Classic Mac
  1. 128K
  2. Lisa
Mobile Phone
  1. iOS
For all that forgot, like me, to multi beast the TRIM option for the SSD, or simply add a SSD, there is a simple terminal way to fix it without programs or tools like trim enabler. It is all shell/terminal made. This tip si good ONLY FOR MAVERICKS or MOUNTAIN LION.
It works with SSD of last generation that support TRIM. If you aren't friendly with shell and terminal don't try it.

Enter in Terminal.
Become super user as usual:

Code:
sudo su

type your super user password

First backup system files (every time backup all that you change), copy & paste there

Code:
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.org

the patch is there, copy & paste

Code:
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

now refresh system kernel cache

Code:
touch /System/Library/Extensions/

exit from sudo

exit from terminal

reboot

All works fine!

Verify in "About this Mac" --> "More info..." --> choose SATA and read in line of the SSD Trim=yes


To disable the trim:


Code:
perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00).{9}(\x00\x54)|$1\x41\x50\x50\x4C\x45\x20\x53\x53\x44$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
touch /System/Library/Extensions/

to restore the original:
Code:
cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.org /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
 
Does this enable TRIM for all SSD ? My problem is that I have a Samsung EVO for my OSX install, which requires TRIM enabled but I also have, for windows 7, a Sandisk Extreme 120GB that doesn't require TRIM to be enabled. I actually read that TRIM on a Sandisk could shorten the SSD life.

Right now, both show TRIM Support YES, but I'm not sure if it only shows that the SSD supports it or if it is active for both.

Do you have any insight on this Z4g0r ?
 
A slim shell script is a great thing. Thanks!
I actually read that TRIM on a Sandisk could shorten the SSD life.
I doubt that. TRIM just tells the SDD which sectors are unused by the OS. Most SDDs need this information for garbage collection. But it is up to the SSD controller what to do with this information.

TRIM commands can slow down disk operation if the OS sends a lot of TRIM commands to the SDD (online discard). This depends on the implementation in the kernel. I don't know how OS-X implements TRIM. For Linux it is recommended to do a batched discard by a cron job. I assume OS-X has its own strategy to do things right. Hey, this is not xxxxx Windows!
 
Yes, Paul, trim is ok for all SSD of third generation, Evo support it. I don't now about Sandisk.
"Trim support = yes" means that trim is enabled for Mac OS
i don't know about "seven" of the command to enable trim
 
Status
Not open for further replies.
Back
Top