Caches, logs & temp files

How to Delete Temporary Files on Mac: Clearing /tmp, /var/folders & Caches

If you have ever checked your Mac's storage and wondered why "System Data" keeps growing, temporary files are a big part of the answer. macOS generates temp files constantly — during app launches, software updates, file conversions, and ordinary use — and it stores them in locations most users never open. This guide explains exactly where to find those files, which ones are safe to delete temporary files on Mac, and how to do it without harming anything in use.

Where macOS Hides Temporary Files

macOS scatters temporary data across several locations. Understanding each one helps you decide what to clean and what to leave alone.

/tmp — The Classic Temp Directory

The /tmp directory is a POSIX standard location that macOS, Unix tools, and many apps use for short-lived scratch files. On modern macOS it is actually a symbolic link:

$ ls -la /tmp
lrwxr-xr-x  1 root  wheel  11 Jan  1 00:00 /tmp -> private/tmp

The real path is /private/tmp. Contents here are not automatically cleared on every reboot — macOS uses a periodic maintenance script (com.apple.periodic-daily) to remove files older than three days, but the exact timing depends on whether your Mac is awake during the scheduled window. If your Mac is often closed at night, old temp files can accumulate for weeks.

/var/folders — The Less-Known Temp Store

This is where macOS keeps per-user, per-session temporary data for sandboxed apps and system services. The full path looks cryptic on purpose:

/var/folders/<two-letter-hash>/<longer-hash>/

Each user account on a Mac gets a unique subfolder combination generated from their user ID. Inside you will find two subdirectories that matter:

  • T/ — true temporary files, deleted when your user session ends or the Mac restarts.
  • C/ — per-user cache files. These persist across reboots and can grow large over time.

To find your own /var/folders path, run:

$ getconf DARWIN_USER_TEMP_DIR

Apps like Xcode, Safari, and various frameworks drop build artifacts, shader caches, and decoded media into these subdirectories. You rarely need to touch them directly — but they are a common reason "System Data" looks bloated in System Settings.

~/Library/Caches — Per-User Application Caches

The user-level cache folder at ~/Library/Caches is distinct from temp files but behaves similarly: apps write data here to speed up future launches and operations, and many never clean up after themselves. Common large occupants include browser caches, Xcode derived data, Spotlight indexes for external drives, and streaming app caches.

# See which apps are using the most cache space
$ du -sh ~/Library/Caches/* | sort -rh | head -20

/Library/Caches — System-Wide Caches

The system-level cache directory at /Library/Caches (no tilde) stores data for system services and apps installed for all users. Modifying it requires administrator privileges. It is generally safer to leave this alone unless you have a specific reason to clear a particular subfolder.

Container Temp Directories

Sandboxed Mac App Store apps write temporary data inside their container:

~/Library/Containers/<bundle-id>/Data/tmp/

These are cleaned when you delete or reinstall the app, but orphaned containers from apps you have already uninstalled can leave significant data behind.

Which Temporary Files Are Safe to Delete?

Location Safe to delete? Caveats
/private/tmp Usually, with care Do not delete files locked by running processes; close apps first
/var/folders/.../T/ Yes, after logout/restart macOS clears these automatically on session end; manual deletion while logged in can break open apps
/var/folders/.../C/ Generally yes Apps will regenerate caches; first launch after clearing may be slower
~/Library/Caches Most subfolders yes Avoid deleting caches for apps currently open; some apps (e.g., Xcode) store important derived data here
/Library/Caches Selective System integrity protection guards some paths; stick to app-specific subfolders you recognize
Container tmp/ for deleted apps Yes Only if the parent app is gone; verify the bundle ID belongs to an app no longer installed

Important: Deletion is permanent. macOS does not move these files to the Trash — they are removed immediately. Always quit the relevant app before clearing its cache or temp folder.

How to Manually Clear Temp Files on Mac

  1. Quit all applications you are not actively using. This releases file locks and ensures you do not delete something a running process needs.
  2. Clear /private/tmp — open Terminal and run:
    $ sudo rm -rf /private/tmp/*
    Enter your administrator password when prompted. The * preserves the directory itself, only removing its contents.
  3. Clear your user cache folder:
    $ rm -rf ~/Library/Caches/*
    You can also open this folder in Finder with Go > Go to Folder (Shift+Cmd+G) and type ~/Library/Caches, then delete individual app subfolders selectively.
  4. Clear /var/folders user temp (T/ directory):
    $ rm -rf $(getconf DARWIN_USER_TEMP_DIR)*
    Only run this after closing all apps; a restart achieves the same effect more safely.
  5. Restart your Mac. A restart clears the session-scoped T/ directories in /var/folders and triggers macOS's own periodic cleanup scripts.

Why Temp Files Survive Restarts (and Keep Growing)

A common misconception is that macOS wipes all temp files on reboot. It does not. The /private/tmp directory persists across restarts. The per-user session temp dirs (/var/folders/.../T/) are cleared on logout, but the cache dirs (/var/folders/.../C/) and ~/Library/Caches are intentional persistent caches — macOS leaves them on purpose to speed up your next session.

Over months and years of use, especially on Macs that are rarely restarted, these directories accumulate gigabytes of data from apps you may have stopped using entirely. That is the bulk of what macOS labels "System Data" or "Other" in storage views.

A Faster Alternative: One-Click Cleaning with Crumb

Tracking down every temp and cache directory manually is tedious, and it is easy to delete something an active app still needs. Crumb automates this safely: its one-click Clean targets system caches, user caches, log files, /private/tmp leftovers, and purgeable system data — checking for file locks before removing anything. It also surfaces your largest cache consumers in a visual treemap so you can see exactly what is being cleared and why.

If you are not sure whether a particular folder is safe to remove, Crumb's built-in AI explains any directory in plain language and gives you a risk rating before you commit to deleting it. You can download Crumb and run one free cleanup to see how much space is recoverable on your Mac.

Conclusion

Temporary files on macOS live in more places than most users realize — /private/tmp, the cryptic per-user hashes inside /var/folders, per-app caches in ~/Library/Caches, and sandboxed container directories. Most are safe to clear once you close the apps that own them, but deletion is permanent and the manual process requires some care. A restart handles the session-scoped locations automatically; the persistent cache directories need deliberate attention a few times a year. Whether you do it by hand in Terminal or with a tool that checks safety first, clearing these files regularly is one of the most reliable ways to reclaim disk space on a Mac without touching anything important.

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

Where are temporary files stored on a Mac?
macOS stores temporary files in several locations: /private/tmp (the system temp directory), /var/folders (per-user session and cache data with cryptic hash-named subdirectories), ~/Library/Caches (per-user application caches), and within app container directories at ~/Library/Containers/<bundle-id>/Data/tmp/.
Does macOS delete temp files automatically on restart?
Partially. Files in /var/folders/…/T/ (session temp directories) are cleared when you log out. However, /private/tmp and ~/Library/Caches persist across restarts. macOS runs periodic scripts to remove files older than three days from /private/tmp, but only when the Mac is awake during the scheduled window.
Is it safe to delete everything in ~/Library/Caches?
Generally yes, but quit any open apps first since deleting an app's cache while it is running can cause crashes or errors. Apps will regenerate their caches on next launch, so you will not lose data — just expect slightly slower first launches. Avoid clearing caches for apps like Xcode that store important derived data there.
What is /var/folders on Mac?
/var/folders is where macOS stores per-user temporary and cache data for sandboxed apps and system services. Each user account gets a unique subdirectory path generated from their user ID. The T/ subfolder holds session temp files (cleared on logout) and the C/ subfolder holds persistent cache data.
How do I find my /var/folders path?
Run this command in Terminal: getconf DARWIN_USER_TEMP_DIR — it prints your exact /var/folders temp path for your current user session.