Is it safe to delete ~/Library/Caches on a Mac? Mostly, and here is the list of what is not a cache
· 2 min read
Every "clean your Mac" guide ends with the same step: open ~/Library/Caches
and delete everything. It is not wrong. It is also usually not where your
space went, and the same guides then send people into neighbouring folders
where the advice stops being safe.
The rule
A cache is something the app can rebuild without you. If you can name what will recreate a file, it is a cache. If you cannot, it is not, whatever the folder is called.
~/Library/Caches is the folder macOS reserves for the first kind, and apps
mostly respect it. Safari's page cache, Spotify's downloaded audio, Xcode's
module cache, Slack's image cache. Delete them and the app fetches them
again.
Doing it
Quit the apps whose caches you are clearing. An app that is running will keep writing into a folder you just deleted, or crash when it reaches for a file that was there a second ago.
# Biggest first, so you know what you are deleting.
du -sh ~/Library/Caches/* 2>/dev/null | sort -rh | head -20
Then delete the contents of the folders you recognise, either in Finder or
with rm -rf ~/Library/Caches/<name>. Leave ~/Library/Caches itself in
place. Some apps fail to start if their cache directory does not exist and do
not know how to recreate it.
/Library/Caches (no tilde) is the system-wide version and holds the same
kind of thing for system services. It needs an administrator password to
touch and is rarely large.
The folders that are not caches
These sit next to Caches in ~/Library, get deleted by people following
the same instinct, and cost real data:
| Folder | What is in it |
|---|---|
Application Support |
Local databases, saved state, message history, licenses |
Containers and Group Containers |
The same, for sandboxed apps: WhatsApp chats, Notes, Mail |
Mail |
Your email, for POP and many IMAP setups |
Keychains |
Every saved password |
Mobile Documents |
Your iCloud Drive, the only local copy |
Preferences |
Every app's settings |
Cookies and HTTPStorages |
Logins for every website |
Application Support and Containers are the ones that catch people, because
some apps do store caches inside them. The way to tell is to look at the
subfolder names: Cache, Code Cache, GPUCache, CachedData inside an
app's container are caches. Data, Documents, Library/Application Support inside it are not.
Why it did not help much
On a developer's Mac ~/Library/Caches is often 5 to 15 GB while the folders
next to it hold ten times that: ~/Library/Developer for Xcode and
simulators, ~/Library/Containers/com.docker.docker for Docker,
~/Library/Application Support/MobileSync for iPhone backups. Each of those
has its own page here.
Where Decruft fits
Decruft applies the rule above in code. Folders under ~/Library/Caches,
package-manager stores, logs and saved state are labelled safe. Application
Support and the container folders are labelled review-first with a note on
what each holds, and the seven folders in the table are refused outright, by
a guard that denies anything it does not recognise as junk. Everything it
does remove goes to the Trash.
Questions
Can I delete everything in ~/Library/Caches?
The contents of ~/Library/Caches regenerate, so emptying it costs one slow launch per app. Quit the apps first. Do not delete the Caches folder itself, and do not go into ~/Library/Containers or Application Support on the same reasoning.
Why did deleting caches not free much space?
Because on most Macs the big folders are not in ~/Library/Caches. Xcode, simulators, Docker, package managers and iPhone backups live elsewhere under ~/Library and can be ten times the size.
What is the difference between Caches and Application Support?
Caches is data an app can recreate from scratch. Application Support is data an app stores for you: local databases, message history, saved logins. Deleting the second one loses things.