The best way to expand your Mac’s lifespan and obtain a significant speed boost is by replacing the hard drive with a solid state drive (SSD). You’ll notice the huge performance improvement right from the first time you boot up and immediately praise yourself for making this investment. However, you shouldn’t stop at installing a new SSD. There is one tiny command line you must type into Terminal to enable a feature meant to expand the lifespan of the newly installed drive; this feature is called TRIM.
What Is TRIM, and Why Do You Need It?
Writing to an SSD is totally different than writing to a traditional hard drive: the SSD first clears existing information from the flash memory cells and programs new data into them; hence, the writing process is often referred as program/erase cycles or P/E cycles. There is one thing to note, though, and that is that there are a limited number of P/E cycles an SSD can support. Writing to an SSD is like writing on a piece of paper with a pencil: if you erase the same space too many times, it can wear out. Manufacturers address this issue with so-called wear leveling, which prevents SSD memory cells (the pages) from wearing out.
SSDs contain memory cells organized into pages and blocks. What represents a challenge is that with an SSD you can write on a page any time, but you can erase only one block at a time. Each block contains a specified number of pages (from 32 to 256), which contain a specified amount of data (2 to 8KB). Unlike traditional hard drives, data on SSDs can’t be directly overwritten. When data changes, it must be written again. The same data (and metadata) ends up being written over and over again in our daily use of computers generating a phenomenon called write amplification, which uses up the limited P/E cycles.
TRIM can be considered a more efficient way of handling “garbage” and was introduced shortly after SSDs became available. The TRIM command allows the operating system to inform the SSD about regions where the data marked for deletion are stored, and after trimming the SSD won’t preserve the contents of the block when it writes new data to a page. This enables less write amplification and, as it doesn’t use up the precious P/E cycles, the SSD’s lifespan will be much longer.
Back Up Your Mac Before Enabling the TRIM Command
You need to enable trimming manually when installing a third party SSD. All Macs shipped with an SSD have TRIM enabled, however, and yours can be checked by clicking on the Apple logo > About This Mac > System Report > SATA/SATA Express and look for “Trim Support”. Note that this won’t work on Retina MacBook Pro (late 2016) units.
If the answer here is “no” and you are running either macOS El Capitan 10.11.x or macOS Yosemite 10.10.4 or later versions, then TRIM can be enabled with one simple command in Terminal. Earlier versions of macOS don’t support this command, but there are third party apps, such as TRIM Enabler ($14.99), that can enable it.
Before you enable TRIM on the freshly installed SSD, we highly recommend doing a manual backup with Time Machine (or the backup service of your preference). Do not skip this step, because – despite supporting it – Apple doesn’t take any responsibility for data loss during the process. If anything goes wrong, the data will be lost and you won’t be able to recover it, so a backup can save the day.
But you don’t want to fill up your backup drive or the precious space on the SSD with all the junk files generated by apps as you use them: cookies, cache files, duplicates, erroneous downloads, iOS firmware downloads and much more should be wiped. For this reason, we strongly recommend performing a system cleanup using a Mac optimization app such as CleanMyMac, MacBooster or OnyX. After the cleaning process your Mac will be in its best shape for a backup and then to enable TRIM.
How to Enable TRIM on macOS in Five Easy Steps
To expand the lifespan of your SSD, follow the steps below:
- Launch Terminal.
- Type the command sudo trimforce enable, and press enter.
- Type the admin password, and press enter.
- Read the system notice, type “y”, and press enter.
- macOS will require your consent to reboot after finishing the process, so type “y” again, and press enter.
After finishing the process your Mac will reboot with TRIM enabled. Check again if TRIM support is now “OK” by clicking on the Apple logo > About this Mac > System Report > SATA/SATA Express, or by typing the following command in terminal:
system_profiler SPSerialATADataType | grep ‘TRIM’.