HomeBlog

How to delete files on a Mac without regretting it

11 August 20269 min read

Almost every deletion on a Mac is reversible for as long as you can resist the urge to tidy up properly. The small number that are not reversible are worth knowing by name.

There is a specific moment, roughly four seconds after emptying the Trash, when you remember what was in it. Everything in this article is an attempt to make that moment less expensive.

What the Trash actually is

The Trash is not a special system. It is a hidden folder called .Trash in your home directory, and moving a file there is an ordinary move.

Two things follow from that, and both surprise people.

Trashing a file frees no space whatsoever. The file is in a different folder on the same disk. If you are deleting things because you are out of room, nothing improves until you empty the Trash. This is also precisely why undo works: the file has not been altered, only relocated.

Every volume has its own. You cannot move a file across disks without copying it, so an external drive keeps its deleted files in a folder called .Trashes at its own root. Delete 40 GB from a backup drive, eject it, then empty the Trash, and those 40 GB are untouched, because macOS could not reach the drive. This one accounts for a lot of "my external drive is still full" confusion and is covered further in the article on hidden files.

Put Back, and why it sometimes refuses

Select something in the Trash, right-click, choose Put Back, and it returns to where it came from. macOS records the original path when the file is trashed, which is how it knows.

It fails in two situations, both logical once you know the mechanism:

Neither is data loss. The file is still sitting in the Trash in both cases. It just needs you to make the decision that macOS declined to make on your behalf.

The one that has no undo

The rm command does not use the Trash. It unlinks the file immediately. There is no Put Back, no recovery, and no confirmation unless you ask for one.

rm -rf ~/Downloads/old-project

That is gone. Not in the Trash, not recoverable through any normal means, gone in about eight milliseconds.

This is not a design flaw. rm is a tool for scripts, and a script that filled up the Trash instead of deleting things would be useless. But it does mean that copying a command off the internet has a materially different risk profile from dragging something to the Trash, and the two feel deceptively similar while you are doing them.

The particular trap. Almost every cleanup guide online, including parts of this one, gives you rm -rf commands because they are compact and unambiguous. Every one of them is irreversible. When you paste one, read the path twice, and be especially careful that no accidental space has crept in after the first slash.

The never list

Short, and worth memorising.

WhatWhy
/System, and /usr outside /usr/localSystem Integrity Protection blocks this anyway. If something appears to let you, that is more alarming, not less
~/.ssh and ~/.gnupgPrivate keys. There is no backup and no reissue. Losing these locks you out of servers and repositories permanently
Anything inside a .app bundleApps are code signed. Changing one file inside invalidates the signature and macOS may refuse to launch it
Files inside the Photos or Music libraryThese are databases. Removing files underneath them leaves broken records. Delete inside the app instead
Time Machine local snapshotsmacOS reclaims them automatically the moment you need space. Deleting them manually costs your local recovery history for space you had coming anyway
Anything you cannot identify in /Library/LaunchDaemonsRuns as root at boot. May be why your VPN, audio interface or backup software works

The three questions

For everything not on that list, three questions settle it faster than any amount of searching.

1. Who created this, me or a program?

If you made it, you know whether you want it. If a program made it, the program has opinions about it existing, and you should find out what they are before intervening. This one question resolves the majority of cases.

2. Does it come back on its own?

Caches, indexes, thumbnails, derived data and build output all regenerate. Deleting them costs a slow first run and nothing else. Documents, photos, keys and configuration you wrote yourself do not come back, ever.

If you are unsure, the folder name is usually honest. Anything containing "Cache", "Derived", "tmp", "Logs" or "Index" is telling you what it is.

3. Could I get it again if I was wrong?

A downloaded installer is replaceable. A film you bought is replaceable. Photos of a person who has died are not. This question is about consequences rather than likelihood, and it is the one worth weighting most heavily, because the cost of being wrong is wildly uneven across files that all look identical in a list.

Reliably safe, in practice. ~/Library/Caches, Xcode derived data, iOS simulator runtimes you no longer target, package manager caches (.npm, .gradle, .cargo), old installer .dmg files, and node_modules in projects you have finished. All regenerate or are re-downloadable.

The one day rule

The single most effective habit in this whole subject, and it costs nothing.

Never empty the Trash in the same session you filled it.

Delete everything you intend to delete. Then use the Mac normally for a day. If something is broken, you will find out during ordinary use, and the fix is dragging one file back out of the Trash. Empty it the next day.

The cost is getting your disk space back a day later than you could have. The benefit is that every mistake in the entire operation stays reversible through the period when you would actually notice it. There is no version of this trade that favours emptying immediately, and yet almost everyone does, because the number at the bottom of the Finder window is satisfying to watch change.

How Strata handles deletion

Three decisions worth stating plainly, because they are the ones that determine whether a cleanup tool is safe to use.

Everything goes to the Trash. Strata uses the same system call Finder uses, not rm. Anything it removes can be recovered with Put Back, by Strata's own undo, or by dragging it out by hand. There is no mode that deletes permanently, because there is no situation where that is worth the risk to you.

Undo restores the exact original path. One step, and every file in the operation goes back where it came from, in the reverse order it was removed. It does not overwrite anything newer that has appeared at that path in the meantime.

Protected paths are refused, twice. There is a list of locations that cannot be deleted regardless of what is selected: system directories, key stores, anything inside an app bundle. The check runs when you select something and again at the moment of deletion, because the time between those two events is exactly when a path can change underneath you.

Delete with a working undo

Strata shows you what you are about to remove and how much space it will actually recover, sends everything to the Trash, and keeps a one-step undo that puts every file back exactly where it was.

Scanning, the map and search are free forever. Deleting, uninstalling and undo are part of Charon, a one-time $12.99 that never expires. If you later want more, you pay the difference and nothing more.

Download Strata for macOS

Common questions

Is Secure Empty Trash still a thing?

No, and its removal was correct. It overwrote files repeatedly, which made sense for spinning disks and does not for SSDs, where wear levelling means the drive decides where data physically lives and an overwrite may not touch the original blocks at all. On an encrypted Mac, which is the default, deleting the file is already sufficient.

Can I recover something after emptying the Trash?

Sometimes, with recovery software, and the odds fall the longer you keep using the Mac. On an encrypted APFS volume with TRIM enabled, which is the default configuration on every modern Mac, the realistic answer is usually no. Treat emptying as permanent and you will never be unpleasantly surprised.

Why does deleting a big file sometimes free nothing?

Two possibilities. It is still in the Trash, which is a move rather than a deletion. Or a running program still has it open, in which case the space is not released until that program closes it or quits. The second is common with log files that something is actively writing to.

Is it safe to delete everything in ~/Library/Caches?

Broadly yes, with one piece of etiquette: quit your apps first. Deleting a cache underneath a running program can confuse it, because it is holding an open handle to a file you just removed. Quit, delete, reopen. The first launch of each app will be slower and then everything is normal.