TRIM is a service that runs in your operating system and works with SSD hardware to track what blocks on the drive are unused, and then prepares them for writing. When put in use, TRIM can optimize SSD performance, especially on drives that are relatively full or used for storing and deleting large amounts of data. Until now TRIM support in OS X was reserved for Apple-supplied hard drives, but with the release of OS X 10.10.4, Apple has included a tool that allows for TRIM on third-party SSD devices.
To enable TRIM on any SSD that you have in your Mac, first ensure you have a full and restorable backup of your Mac. You can do this using Time Machine, or a variety of third-party cloning and dedicated backup utilities for OS X. Then be sure you have OS X 10.10.4 or later installed, and then open the Terminal and run the following command:
sudo trimforce enable
Supply your password when prompted, and then confirm you wish to proceed by pressing “y” when prompted. After a few moments, the system will reboot and you should have TRIM enabled.
Per Apple’s warning when you attempt to use this tool, keep in mind that because TRIM relies on OS X to help track drive usage, Apple cannot be sure all devices have been properly tested, so Apple offers this tool “as-is” with no guarantee.
While rare, data corruption and unexpected behavior could potentially occur when using TRIM, therefore unless you feel you need it, you might consider doing without enabling TRIM. For the most part, unless you are doing tasks that push the performance envelope of your drive and Mac, you will likely not see a significant increase in performance when using TRIM. In fact, some devices may poorly interact with TRIM on OS X and show notable decreases in performance, so your mileage may vary.
If you are using a third-party SSD and have not yet upgraded to OS X 10.10.4, then you can use several third-party tools like TrimEnabler to activate TRIM on older systems; however, again keep in mind the results may not always be positive.
If you find that TRIM is not giving you the results you were expecting, then you can disable it by running the same command with “disable” instead of “enable” as shown above:
sudo trimforce disable
UPDATE: Added information on how to disable TRIM