Caches, logs & temp files

What Are Cache Files on a Mac? Caches, Logs & Temp Files Explained

If you have ever opened your Mac's storage report and seen a suspicious chunk labeled "System Data" or poked around ~/Library and found gigabytes of files you don't recognize, you have stumbled onto the world of cache files. Understanding what cache files actually are — and how they differ from logs and temp files — takes the mystery out of that hidden storage and tells you when clearing them helps versus when it can cause problems.

What Are Cache Files?

A cache file is a saved copy of data that an app or the operating system expects to need again. Instead of re-computing or re-downloading the same information every time, the software stores a local snapshot and reads from disk next time — which is usually faster than rebuilding from scratch.

Think of it as a sticky note on your desk. Writing it once means you don't have to look up the same phone number repeatedly. Your Mac does the same thing, just at massive scale.

Where Mac Caches Live

macOS organises caches in predictable locations:

  • User caches~/Library/Caches/ — per-app data for the currently logged-in user (Safari's page cache, Xcode's derived data, Spotify's offline content, etc.)
  • System caches/Library/Caches/ — shared caches used by system services and some third-party daemons
  • Font caches/System/Library/Caches/com.apple.FontRegistry/ — rebuilt automatically by the system
  • DNS cache — held in memory by mDNSResponder, flushed with a Terminal command, never stored as files on disk
  • App-specific caches — some apps (Chrome, Electron-based tools) maintain their own cache inside ~/Library/Application Support/ rather than ~/Library/Caches/

What Is Cache on Mac: a Concrete Example

Open Safari and visit a news site. Safari downloads the site's logo, stylesheet, and several images. Those assets are saved to ~/Library/Caches/com.apple.Safari/. The next time you open that page, Safari checks the cache first. If the files are still fresh (based on HTTP headers), it loads them from disk rather than the network — the page appears faster and uses less bandwidth.

The same pattern applies at the OS level. When you launch an app, macOS can save a pre-linked version of its code in the dyld shared cache (/private/var/db/dyld/) so future launches skip the slow link step entirely.

Cache vs. Logs vs. Temp Files: What's the Difference?

These three categories often get lumped together, but they serve different purposes and carry different deletion risks.

Type Purpose Typical location Safe to delete?
Cache files Speed up future operations by storing pre-computed or downloaded data ~/Library/Caches/, /Library/Caches/ Generally yes — apps rebuild them on demand
Log files Record app and system events for debugging ~/Library/Logs/, /Library/Logs/, /var/log/ Usually yes — but keep recent logs if troubleshooting a problem
Temp files Hold in-progress data that an app plans to clean up itself /private/tmp/, /private/var/folders/.../T/ Mostly yes — macOS purges /tmp on restart; deleting manually is low-risk
Derived data / build artifacts Compiled output created by Xcode and other dev tools ~/Library/Developer/Xcode/DerivedData/ Yes — Xcode will simply rebuild next build

When Caches Help Performance

Caches are genuinely useful. A populated cache means:

  • Apps launch faster (the OS skips slow startup work)
  • Websites load faster (repeat assets come from disk, not the network)
  • Mail, Messages, and Photos load thumbnails instantly instead of regenerating them
  • Spotlight and Siri respond faster because their index is cached in memory

In normal daily use you should leave caches alone. macOS manages them automatically and evicts old entries when storage pressure rises — that is what the "purgeable" number in About This Mac → Storage actually represents.

When Caches Hurt Performance (or Cause Problems)

Caches can become a problem in a few specific scenarios:

  • Stale or corrupted caches. If an app update changes its data format but the old cache files remain, the app can crash or behave oddly. Deleting the app's cache folder forces a clean rebuild.
  • Runaway cache growth. Some apps (Xcode derived data, Homebrew's download cache, old iOS device backups) accumulate tens of gigabytes over time because they have no automatic expiry.
  • Low-storage Macs. On a 256 GB drive, even a modest 10–15 GB of stale cache is meaningful. Clearing it reclaims real, writable space — not just purgeable space.

What Are Temporary Files and Why Do They Accumulate?

Temporary files (temp files) are short-lived working files an app creates while doing something — extracting an archive, rendering a video frame, compiling code. In theory the app deletes them when it is done. In practice, if the app crashes or is force-quit mid-task, the temp files are orphaned.

macOS clears /private/tmp on every restart. The per-user temp folder, whose path changes each login session, lives inside /private/var/folders/ and is a two-level random-looking directory like:

/private/var/folders/xx/xxxxxxxxxxxxxxxxxx/T/

You can print your current temp folder path in Terminal:

echo $TMPDIR

Most files there are safe to delete when the owning app is not running, though it is rarely necessary — macOS handles it on the next restart.

How to Flush the DNS Cache on macOS

Despite what many guides claim, the DNS cache is not stored as files. It lives in memory and must be flushed via Terminal. This is useful when a domain's IP address has changed but your Mac still resolves the old one:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

You will be prompted for your password. No output means it succeeded.

What Is Actually Safe to Delete — and What Is Not

This is where many guides go wrong by either being recklessly permissive or uselessly vague. Here is a practical breakdown:

Generally Safe

  • Contents of ~/Library/Caches/ — user-level app caches; apps rebuild them
  • Contents of ~/Library/Logs/ — log files; only keep if actively debugging
  • ~/Library/Developer/Xcode/DerivedData/ — rebuilt on next Xcode build
  • Homebrew's download cache: $(brew --cache) — usually ~/Library/Caches/Homebrew/

Use Caution

  • Safari's cache — safe, but you will see a slowdown on first page loads afterward
  • Spotlight index — do not delete manually; use System Settings → Siri & Spotlight → Spotlight Privacy to rebuild it properly
  • Font caches — let macOS manage these; manual deletion can cause temporary display issues that resolve after a restart

Do Not Delete

  • Anything inside /System/ — protected by System Integrity Protection (SIP)
  • ~/Library/Application Support/ — this is app data (preferences, databases, saved state), not cache. Deleting it can erase your settings or app content
  • Active Time Machine snapshots in /.MobileBackups/
  • Any folder you cannot identify — look it up before deleting

The "Is This Safe to Delete?" Problem

The hardest part of manual cache cleaning is encountering a folder with a cryptic bundle ID like com.electron.someapp.helper and not knowing whether deleting it will break something. You can Google every path, but that gets tedious fast.

Crumb has an "Is this safe to delete?" AI built in: select any file or folder in the Visualize view and ask. It explains what the folder is, which app created it, and the real risk of removal — so you can make an informed decision rather than guessing. Crumb also does one-click cleaning of the standard safe categories (user caches, logs, temp files, and purgeable System Data) without you having to navigate each folder manually. You can download Crumb and try a free cleanup to see how much space is actually recoverable on your Mac.

Conclusion

Cache files are a normal, intended part of how macOS and its apps keep things fast. The vast majority of the time you should leave them alone and let the OS manage them. The cases where manual cleaning genuinely helps are specific: corrupted caches causing app misbehavior, runaway caches from developer tools, or reclaiming space on a nearly-full drive. When you do clean, stick to user-level caches, logs, and temp files — and always know what a folder is before you delete it. Cleaning is permanent, so a moment of caution is worth it.

Reclaim your disk in one click

Crumb audits your whole Mac, tells you what's safe to delete, and frees the space in seconds — private, local, and Apple-notarized.

Download Crumb for macOS

Frequently asked questions

What are cache files on a Mac and is it safe to delete them?
Cache files are saved copies of data — downloaded web assets, compiled app code, generated thumbnails — that help apps and macOS run faster on repeat use. Contents of ~/Library/Caches/ are generally safe to delete because apps rebuild them automatically. However, caches inside ~/Library/Application Support/ are actually app data, not caches, and deleting them can erase settings or saved content. When in doubt, look up a folder before removing it.
What is the difference between cache, logs, and temp files on a Mac?
Cache files store data for reuse to speed up future operations. Log files record events and errors for debugging — they grow over time but are safe to delete. Temp files are short-lived working files created mid-task; macOS clears /private/tmp on restart, so orphaned temp files rarely require manual action. All three are distinct from Application Support folders, which hold permanent app data.
How do I find what is taking up space in my Mac's cache folders?
Open Terminal and run: du -sh ~/Library/Caches/* | sort -rh | head -20 — this lists your largest per-app user cache folders by size. For a visual overview, the Visualize feature in Crumb renders your entire disk as an interactive treemap so you can identify the biggest folders at a glance without Terminal.
Will clearing my Mac's cache make it faster?
Not always. A populated cache generally makes things faster because apps skip re-downloading or re-computing data. Clearing caches can improve performance when they are stale or corrupted (causing app slowdowns or crashes), but for a healthy Mac with plenty of free space, cleaning caches provides little speed benefit and may even slow down the first launch of apps afterward while they rebuild.