How to Clear Cache on Mac
To clear an app's cache on a Mac, quit the app, choose Go › Go to Folder in Finder, enter ~/Library/Caches and move that app's folder to the Trash. For browsers, use their own settings: Develop › Empty Caches in Safari, Delete Browsing Data in Chrome, or Clear Data in Firefox. Caches are safe to remove, but they come back as you use your apps, so clear them to fix a problem or free space, not on a schedule.
What a cache is
A cache is a set of files an app saves so it can work faster next time: thumbnails, downloaded web pages, compiled code, map tiles. Removing it is safe, because the app downloads or rebuilds what it needs. The cost is that the app is slower for a while until it does.
Clearing a cache helps when:
- An app shows old content or wrong images, or behaves oddly after an update.
- A website doesn't load correctly in one browser.
- You need disk space, and a cache has grown large.
User caches and system caches
- User caches are in ~/Library/Caches, the Library folder inside your home folder. Each app has its own folder, usually named like com.apple.Safari or com.spotify.client. These are the ones to clear.
- System caches are in /Library/Caches and /System/Library/Caches. macOS manages them. /System is protected, and there's no need to clear /Library/Caches by hand. A restart lets macOS clean up its own temporary files.
Some apps keep caches elsewhere. Apps from the App Store keep theirs inside ~/Library/Containers, in each app's Data/Library/Caches folder. Apps built with Electron, such as Slack, Discord and VS Code, keep caches in ~/Library/Application Support under the app's name, in folders called Cache, Code Cache and GPUCache.
How to clear user caches safely
- Quit the app whose cache you're clearing with ⌘Q (Command-Q). A running app can recreate files or crash.
- In Finder, choose Go › Go to Folder, or press ⇧⌘G (Shift-Command-G).
- Type ~/Library/Caches and press Return.
- Find the app's folder. To see which folders are largest, switch to List view, choose View › Show View Options, turn on Calculate All Sizes, then sort by Size.
- Move the folder to the Trash with ⌘Delete (Command-Delete).
- Open the app and check that it works. Then empty the Trash.
Moving to the Trash first means you can put things back if something goes wrong. There's little reason to empty the whole Caches folder at once. It makes every app rebuild at the same time, and most of the space usually sits in a few large folders.
Browser caches
Safari
- Choose Safari › Settings, click Advanced and turn on "Show features for web developers".
- Choose Develop › Empty Caches, or press ⌥⌘E (Option-Command-E).
This clears cached files without touching your history, cookies or saved passwords. To remove the data one website stored, go to Safari › Settings › Privacy › Manage Website Data.
Chrome
- Choose Chrome › Delete Browsing Data, or press ⇧⌘⌫ (Shift-Command-Delete). Older versions call it Clear Browsing Data.
- Choose a time range.
- Select only "Cached images and files", unless you also want to delete history or sign out of websites.
- Confirm.
Firefox
- Choose Firefox › Settings, then Privacy & Security.
- Under Cookies and Site Data, click Clear Data.
- Select only the cache option (called Cached Web Content or Temporary cached files and pages, depending on the version) and confirm.
App caches
Some apps have their own clear-cache option. Spotify has one under Settings › Storage, and Slack has Help › Troubleshooting › Clear Cache and Restart. Use those first, because the app knows what's safe to remove. For apps without one, quit the app and move its folder in ~/Library/Caches to the Trash as described above.
DNS cache
macOS also caches the addresses of websites you visit. If a site moved to a new server and still won't load for you, or a network change left names resolving to old addresses, clear it in Terminal:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Enter your administrator password when asked. Nothing is shown when it works. This doesn't free disk space; it only makes the Mac look up addresses again.
Developer caches
Developer tools can build up tens of gigabytes. Each has a safe command; use it rather than deleting folders by hand.
| Tool | What to run | What it does |
|---|---|---|
| Xcode | Delete ~/Library/Developer/Xcode/DerivedData | Removes build output. Xcode rebuilds it. Quit Xcode first. |
| npm | npm cache clean --force | Clears downloaded packages. Projects download them again when needed. |
| pnpm | pnpm store prune | Removes packages no project uses anymore. |
| Yarn | yarn cache clean | Clears downloaded packages. |
| pip | pip cache purge | Clears downloaded Python packages. |
| Homebrew | brew cleanup | Removes old versions and downloads. |
| Docker | docker system prune | Removes stopped containers, unused networks and dangling images. Stopped containers are deleted for good. |
Simulators for old iOS versions are another common one: xcrun simctl delete unavailable removes those you can no longer use. For the rest of the developer data that ends up in System Data, see how to clear System Data.
Why caches come back
Caches are meant to grow. Every website you visit, every song you stream and every project you build adds to them. Clearing them frees space for a while, then they fill up again. Many apps also limit their own cache size.
That's why clearing caches every week doesn't keep a Mac fast, and why apps can feel slower right after. Clear a cache when an app misbehaves, when one cache has grown out of proportion, or when you need space now. If the Mac itself is slow, the cause is usually somewhere else: see why your Mac is slow.
Clear caches with SystemWatch
SystemWatch's Storage scan, part of its Mac cleaner, finds large caches and explains each one: what it's for, and what happens if you remove it. Cleaning moves items to the Trash, and you can undo any cleanup from Cleanup History. In the App Store edition, the scan is free and one-click cleanup with undo is part of SystemWatch Pro.
The website edition adds Deep Clean with Full Disk Access. It runs each tool's own cleanup for Homebrew, Docker, old simulators, and npm, pnpm, Yarn and pip, and asks you to confirm each one first.