The trimforce utility allows you to activate TRIM on third-party devices connected to the AHCI controller; by default, TRIM commands are not sent to third-party storage devices. The trimforce utility has appeared since OS X 10.10.4.
On original devices, TRIM is used by default and no commands need to be entered.
Before activation, you must make sure that all devices support TRIM, for example, if you installed a new third-party SSD, you can see the specifications on the manufacturer’s website.
To activate TRIM on all third-party devices, open the Terminal and execute the command:
sudo trimforce enable
After entering the command, a warning will be displayed stating that TRIM will be enabled on all devices that have not yet been verified, the user is responsible for the safety of the data and it is recommended that a backup copy of all the data be taken, as they may be lost or damaged.
After entering the command, a reboot is required.
You can disable TRIM for third-party devices by running the command (on the original drives, TRIM will still be used):
sudo trimforce disable
See also my article:
Replacement HDD for fast SSD in Apple MacBook Pro