Sub topic 7
Excluding items to save space
This chapter explains how Time Machine decides what to skip, how to add your own exclusions in System Settings and with tmutil, and what exclusions do and don't do. It assumes you have finished the first backup (see the setup chapter) and can open Terminal for the command-line sections.
How exclusions work
Time Machine backs up your data volume, then skips anything on an exclusion list. There are three sources of exclusions:
- Built-in exclusions. macOS skips items it can rebuild, such as caches, the Trash, and Spotlight indexes. It also never backs up the backup disk itself.
- Path exclusions that you add in System Settings. These are tied to a location.
- Sticky exclusions that you add with
tmutil addexclusion. These are stored as an extended attribute on the item itself, so they follow the item if you move or rename it.
Exclusions only affect future backups. Existing backups keep everything they already contain until they age out or you delete them.
Deciding what to exclude
Good candidates share one of three traits: they are large, they can be recreated, or they change often.
| Candidate | Why exclude it | Caution |
|---|---|---|
| Downloaded installers and disk images | Re-downloadable | Keep ones you cannot get again |
| `node_modules`, build folders, Xcode `DerivedData` | Recreated by a build or package install | Back up the source and lockfiles |
| Virtual machine disk images, Docker data | Huge, and rewritten often | Excluding them means no backup of the VM contents |
| Cloud-synced folders | Already stored online | Sync is not backup, so check your retention |
| Video render caches, scratch disks | Large and temporary | None for true caches |
| Photos, documents, mail, projects | Never exclude these | They are what the backup is for |
Before excluding, measure. Find large folders in your home directory:
du -sh ~/* ~/Library/* 2>/dev/null | sort -h | tail -n 15The sort -h option orders human-readable sizes, so the biggest items appear at the bottom.
Excluding in System Settings
- Open System Settings > General > Time Machine.
- Select Options….
- Under the exclusion list, click + and choose a folder, file, or volume.
- Click Save.
The Options sheet also shows an estimated size for the backup. Remove an exclusion by selecting its row and clicking −.
A folder you add this way is a path exclusion. If you rename the folder or move it elsewhere, Time Machine sees a new, unexcluded item and backs it up.
Excluding with tmutil
The command line is better when you need many exclusions or want a repeatable setup. This example, from the tutorial's command set, excludes one folder and then checks it:
tmutil addexclusion ~/Downloads/large-files
tmutil isexcluded ~/Downloads/large-filesisexcluded prints [Excluded] or [Included] followed by the path. Run it after every change, because a typo in a path produces an error rather than a silent success only some of the time.
To undo an exclusion:
tmutil removeexclusion ~/Downloads/large-filesSticky versus fixed-path exclusions
By default, addexclusion writes a sticky exclusion. Add -p to create a fixed-path exclusion, which is stored in a system preference file and stays tied to that location. Fixed-path exclusions need administrator rights:
sudo tmutil addexclusion -p /Users/Shared/Scratch
sudo tmutil removeexclusion -p /Users/Shared/Scratch| Property | Sticky (default) | Fixed path (`-p`) |
|---|---|---|
| Where it is stored | On the item itself | In a system preference file |
| If you move the item | Exclusion moves with it | Exclusion stays at the old path |
| Needs `sudo` | No, for your own files | Yes |
| Good for | Folders you own and might reorganize | Shared or system-level locations |
Excluding many folders at once
Developers often have dozens of node_modules folders. addexclusion accepts several paths, so you can combine it with find:
find ~/Projects -name node_modules -type d -prune -exec tmutil addexclusion {} +The -prune option stops find from descending into each node_modules folder once it is matched, which keeps the search fast and avoids matching nested copies. Because these are sticky exclusions, they stay with the folders. New projects need the command run again.
What exclusions do not do
They do not shrink existing backups
Excluding a folder does not remove its earlier copies. To reclaim that space, open the Time Machine browser for the folder (see the restore chapter), select the item, and use Delete All Backups of… from the action menu. This is permanent for those copies, so confirm you do not need them first.
Without deleting, the old copies are removed only as Time Machine thins old backups or needs room, as described in the schedule and retention chapter.
They do not apply to local snapshots reliably in your planning
Treat exclusions as a rule for the backup disk. Local snapshots on your startup disk are a separate mechanism, covered in their own chapter, and they capture the state of the volume at a point in time. Do not assume an exclusion frees space on your Mac's own disk.
Common errors
- Excluding the wrong level. Excluding
~/Libraryto save space also drops application settings, mail, and keychains. Exclude specific subfolders such as~/Library/Caches(already skipped in most cases) or one app's cache. - Relying on a path after moving a folder. A path exclusion from System Settings does not follow a renamed folder. Use
tmutil isexcludedto recheck after reorganizing. - Forgetting that a sticky exclusion may not survive copying. If you copy an excluded folder with a tool that does not preserve extended attributes, the copy may be included. Check the copy.
- Excluding something you later need. Excluded items have no backup history. Review the exclusion list every few months.
- Using
-pwithoutsudo. The command fails with a permissions error. Prefix it withsudo. - Excluding a volume you assume is protected elsewhere. A cloud service that syncs deletions will delete your cloud copy too. Confirm that service keeps versions before excluding.
Checking the result
After setting exclusions, run a backup and watch it complete:
tmutil startbackup --block
tmutil statusThen open Options again and compare the estimated backup size with the earlier value. If it did not change, check each path with tmutil isexcluded.
Exercise
You excluded ~/Projects/app/build in System Settings, then renamed the folder to ~/Projects/app/output. Time Machine starts backing it up. Why, and what would have prevented this?
Show answer
A System Settings exclusion is a path exclusion, so it applies to the old location, not to the folder's new name. Using tmutil addexclusion without -p creates a sticky exclusion stored on the folder itself, which follows the folder when it is renamed. You can confirm with tmutil isexcluded ~/Projects/app/output.
Exercise
After excluding a 200 GB virtual machine folder, your backup disk is still nearly full. Why, and how can you free the space?
Show answer
Exclusions affect only future backups, so earlier copies of the folder remain. Open the folder in the Time Machine browser and choose Delete All Backups of that item, or wait for old backups to be thinned. Check that you do not need the history first, because the deletion is permanent.