HOW OS X open the gate for TRIM on 3rd party SSD

For many years(since 10.6.8 maybe), the IOAHCIBlockStorage.kext driver in the OS X only allow TRIM to be enabled on Apple SSD. Such behavior denied all those 3rd party SSD to enable this essential technology while running OS X. Although it was possible to hex edit the binary IOAHCIBlockStorage file(manually or by some tools) to force enable TRIM on any SSD, however, began with the OS X 10.10, any modification on the protected kexts would cause the kext signature validation failure and the modified kexts would be denied to load without adding “kext-dev-mode=1” to boot-args explicitly. Furthermore, in the newest dev build of OS X 10.11, the kext signing become a part of the newly introduced System Integrity Protection (SIP) technology, along with the filesystem and runtime protection. In order to modify the protected kexts, the entile SIP must be turned off. This kind of trade-off could be a great impact on the whole system security mechanism.

The good news is, starting with OS X 10.10.4, and also in the current 10.11 build, Apple finally open the gate for all 3rd party SSD on the TRIM support by providing a CLI tool. By running this command in the Terminal, the TRIM would be enabled on all SSD attached after the system reboot:

So how this little tiny tool do to enable TRIM? What does this tool do to the system?

The secret is:

After executing the command above, an Apple signed codeless kext, AppleDataSetManagement.kext, is generated and being installed to the /System/Library/Extensions/. The Info.plist inside this special kext contains the key property needed for the IOAHCIBlockStorage driver to enable TRIM without checking the SSD brand. As it shows below:


Compare it to the Info.plist in the IOAHCIBlockStorage.kext, a boolean property “Force Data Set Management = True” is set. This is exactly the one under the surface. While the IOProbeScore is set to 5000 is to ensure that this plist got the first change to load.

That’s how it is done on a Mac computer.

For Hackintosh user, disable SIP to turn off the kext signing might be unavoidable in order to get all the unsigned kext loaded. However, this property can be added to any Info.plist such as FakeSMC.kext or just create the codeless kext by your own. In such case, with the help of Kext injection function by Clover, TRIM can always be enabled even in Recovery or OS X Install environment and there is no need to deal with the original IOAHCIBlockStorage and the “trimforce” tool any more since an equivalent injection could been made easily.

Update 1: After the TRIM is enabled, the kernel log shall have such records below during the system boot:

PM kernel[0]: *IOAHCIBlockStorageDriver::DetermineDeviceFeatures – !!!!! WARNING !!!!! – Force Data Set Management is set

Leave a Reply

Your email address will not be published. Required fields are marked *