So your Mac isn't performing as well as it used to and needs a speed boost. You think back to what you used to do on your old PC and remember disk defragging - that should have the same effect on Macs, right? After all, it made your old PC run a lot faster.

Windows has always had disk defragging software - in fact, Windows 10 (and Windows 8 and Windows 7) automatically defrags on a weekly basis (you’ll find it referred to as "Optimise Disk" in recent OS release, you can adjust how often these defrags happen).

Apple, on the other hand, has never included defragging software in macOS. "Why's that?" you may ask. Well, there are a number of reasons why Macs don't offer a defrag function:

  • Macs don't typically experience the kind of fragmentation that Windows PCs are prone to.
  • Modern Macs defrag files automatically, they’ve done this since OS X 10.2 launched in 2002.
  • Defragging can damage a drive because moving files around wears the drive out.
  • If you have an SSD defragging will have no benefits and will damage your drive.

In this article we will explain why you probably don’t need to defrag your Mac, the rare occasions when you might need to defrag a Mac, what might really be causing the issues you are facing, and how to defrag a Mac if that is what needs doing after all.

But before we go on to that, we’ll start by explaining how data is written to a drive, why PCs need to be defragged, and why things are different for Macs.

Mac defragmentation software

Why some PCs need to be defragged

When a file is saved to a PC hard drive it fills the available space in an efficient way. If you’ve been using a disk for a long time there may be lots of gaps left by files you have deleted, rather than leaving these gaps vacant, when you save a file Windows will put it to one of these gaps. (Kind of like in the image below, which incidentally is of a Mac app that is no longer available).

If you want to save a large file - a video, for example - it might need to be spread, or fragmented, over a number of these gaps. The PC knows where the parts of the file are, but if there are a lot of fragmented files it can take a long time for it to find all the necessary parts before opening the file.

How to defrag a Mac: iDefrag

By defragging the drive the files are all shuffled back in order to fill any holes that have appeared when files were deleted - which should avoid files being fragmented in future - and fragmented files are put together.

This only applies to hard drives though, and not as much as it used to: NTFS (the more modern filesystem) doesn’t tend towards fragmentation as much as FAT-32 did (the older file system).

Also, modern SSDs (aka Flash drives) don’t need to be defragged, in fact doing so can damage them, as we will explain below.

Why Macs don’t need to be defragged

As we’ll explain below, you probably don’t need to defrag your Mac. If any of the following applies to you we would suggest that defraging is not the solution to your problem:

  • Your Mac operating system does not predate 2002 (if it does can we suggest you update your Mac!)
  • Your Mac has an SSD.
  • If you are running High Sierra or Mojave, and your file system has been changed to Apple’s newer APFS, you will not be able to use any third party tools to defrag your Mac as there are none that work.

Mac do not need to be defragmented because the file system (initially HFS+ and more recently APFS) prevents fragmentation and automatically defrags files if necessary - if the file has more than eight fragments, or is smaller than 20MB, it will be automatically defragged.

HFS+, which was introduced in 1998, could defrag files on the fly thanks to Hot File Clustering. Then in Mac OS X 10.2, which arrived in 2002, the system got even cleverer at avoiding fragmentation. A year later, in 2003, Hot File Adaptive Clustering arrived, which identifies files that are frequently accessed but rarely updated and moves them to a special area of the drive, defragging them during the process.

Apple then introduced APFS (Apple File System) in High Sierra in 2017. APFS was initially only available on SSDs (which as we’ve already said, shouldn’t be defragged anyway), but it arrived on hard drives and Fusion drives in 2018 with Mojave. Like its predecessor, APFS automatically defragments your drive on the fly, although it works a little differently as it creates snapshots of files so you can access different versions of the same files.

The companies that make tools for defragging Macs complain that Apple hasn’t issued sufficient information about how APFS works for them to be able to be able to offer tools to defrag the new filing system. No doubt Apple’s response to that would be that APFS will not benefit from defragging.

Chances are that if you are having a problem with your Mac it is unrelated to fragmented files. Luckily Macs have a number of tools in Disk Utility for troubleshooting and fixing various problems with your system, so it’s worth having a look there. We have this guide to using Disk Utility here, and also various troubleshooting tips for fixing a Mac.

When Macs need to be defragged

The only reason you might need to defrag your Mac is if the following applies:

  • Your Mac has a hard drive.
  • You are running out of storage space (we always advise keeping 10% of your storage free).
  • You are frequently saving particularly large files, greater than 1GB.

One reason why a hard drive might slow down if files are particularly fragmented is because it has moving parts (unlike an SSD) and it has to move the head around to read the different bits of the file you want to open.

If you have less than 10% of your storage free the Mac will not be able to perform automatic defragmentation. In this case, rather than attempting to defrag it might be better to delete some files, or even wipe your Mac and do a clean install.

On that latter point, some Mac users prefer to do a clean install before a major OS update in order to improve performance, and doing so will effectively defrag your Mac.

How to defrag a Mac

Sure you need to defrag your Mac despite all the above? There are a few apps that will be happy to help.

However, some of the tools that were developed for the purpose of defragging Macs are no longer in development. One such tool was iDefrag, made by Coriolis Systems, but that company stopped development following the mass adoption of SSDs when the launch of macOS 10.13 High Sierra bought APFS.

Tech Tool Pro 11

While Tech Tool Pro doesn’t support defragmenting for APFS volumes, and does not advise its use for an SSD, it is capable of defragmenting individual files on a hard drive. It has various other features and is Mojave compatible, apparently.

A full version of the app costs £124.99 from Micromat

Drive Genius 5

Prosoft Engineering’s Drive Genius offers to defrag your Mac. It will show you a graphical representation of how fragmented your volume is and will then offer to defrag, or reorganize, the fragmented files, regardless of size or fragmentation level. There are 18 different features offered in addition to defragmentation, however, if you are using macOS 10.13 or newer the Defragment, Repartition, and Rebuild utilities are not supported on APFS.

There’s a free demo or you can buy Drive Genius 5 from Prosoft here.

Mac defrag

How to defrag a Mac for free

As we’ve explained, you probably don’t need to defrag your Mac, and if you decide you do, you could try one of the tools mentioned above - although we’d suggest that they might do more harm than good (we think Apple has good reasons for not including such tools as part of the macOS).

If you believe that your Mac has a defragmentation issue then the best solution is free: Back up your drive using Time Machine and do a clean install, as mentioned above.

Here's how to use Time Machine to back up and how to restore your Mac from Time Machine.

Find out what’s really wrong with your Mac

As we've said, it's probably not a defragmentation issue anyway.

To see what’s really wrong you could use a few tools available on your Mac, such as Activity Monitor, to check what's using CPU, and also Disk Utility to see if there is a problem with your disk.

If you are running an ancient version of Mac OS X we predict that your drive might actually be failing, in which case, you might want to read How to recover data from a damaged Mac.

We have various tips about how to speed up a slow Mac here that we suggest you work through.