Where apps hide your files
Your Mac has a per-user temp folder with a random-looking path, plus two shared ones at /tmp and /var/tmp. One command prints yours, and the rest of this page covers what lives there and what is safe to remove.
Your personal temp folder is different on every Mac, because part of the path is generated per user. Ask the system for it:
echo $TMPDIR
getconf DARWIN_USER_TEMP_DIR
Both print a path of this shape:
/var/folders/xx/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy/T/
xx is two characters and yyyy... is a longer string. Together they are unique to your user account. The real location is /private/var/folders/..., because /var is a link to /private/var. Both spellings reach the same folder.
To open it in Finder, run open "$TMPDIR" in Terminal. Or press ⇧⌘G in Finder and paste the path from echo $TMPDIR.
| Location | Purpose | Cleared |
|---|---|---|
$TMPDIR (the T folder) | Per-user scratch space for apps and system services | Automatically; stale files go, and a restart clears more |
/tmp (a link to /private/tmp) | Shared scratch space for command-line tools and scripts | Automatically over time, not guaranteed |
/var/tmp (/private/var/tmp) | Shared, meant for files that should outlast a restart | Less aggressively than the others |
Treat all three as places where nothing is promised to stay. An app that stores something important in a temp folder is relying on luck.
Open the parent of T and you will find sibling folders, each with a job. You can list them with ls "$(dirname "$TMPDIR")". The three below are the ones getconf reports; you may see others, such as X.
| Folder | What it is | Print its path with |
|---|---|---|
T | Temporary files | getconf DARWIN_USER_TEMP_DIR |
C | Per-user caches, a folder of one subfolder per app or service | getconf DARWIN_USER_CACHE_DIR |
0 | Per-user data used by system services | getconf DARWIN_USER_DIR |
The C folder is where many apps and system components keep caches that never show up in ~/Library/Caches. If you are hunting for a hidden space hog, look there as well as in the user Library.
Apps from the Mac App Store, and other sandboxed apps, usually keep their temporary files in their own container rather than in your T folder:
~/Library/Containers/<app identifier>/Data/tmp
The container folder is named after the app's bundle identifier for most apps; a few have a long random-looking ID instead. Find the one you want with ls ~/Library/Containers | grep -i <part of the app name>, then open its Data/tmp folder.
The temp folder can grow past a gigabyte: on the Sequoia Mac checked for this page, T held 1.4 GB in more than 30,000 items. Check yours with:
du -sh "$TMPDIR"
That command only reads. The sensible rules:
T, not C, not 0, and not the two oddly named folders above them. The system expects them to exist.rm. If you must clear something, look at the oldest and largest items by name, quit the app that owns them and move them to the Trash. Do not run a wildcard delete on /var/folders.Anything you would call a document, such as a half-saved file an app crashed on, is worth looking for before the restart. Apps such as editors and Office suites often keep recovery copies in their own folders, so check those before you assume a temp file is junk.
The /var/folders tree is hidden from normal browsing and Spotlight does not index it. Finder will not show /private in the sidebar, and /var and /tmp are hidden folders. Use Go > Go to Folder (⇧⌘G), or press ⇧⌘. in a Finder window to toggle hidden items.
Temp items are often named after the app that made them. Many folders inside T start with a bundle identifier, such as com.google.Chrome followed by a few random characters, and files inside often keep their original names. A file an app was working on when it quit may still be there until the next cleanup.
If you find what you need, copy it to your Documents folder straight away (hold ⌥ while you drag, or use Copy and Paste) so it outlives the next cleanup. One exception: Mail does not use T for attachments you open. It saves them in its container, under ~/Library/Containers/com.apple.mail/Data/Library/Mail Downloads.
Everywhere helps where Spotlight gives up: it indexes /private, so /var/folders and /tmp are covered with nothing to switch on, and typing a fragment of the lost file's name, such as invoice or export, lists matches there in milliseconds. Live updates skip /private, though, so a temp file written in the last few minutes may not be listed until the next scan; for that, open $TMPDIR in Finder as shown above and sort by date. App containers' tmp folders join the results once Everywhere has Full Disk Access, and ⌘↵ reveals a match in Finder so you can copy it somewhere permanent. It searches names only, so the words inside the file will not match.
Run echo $TMPDIR in Terminal. It prints a path like /var/folders/xx/yyyy/T/, which is unique to your user account. /tmp and /var/tmp are the shared temp folders.
Do not wipe the folder. Restart the Mac so macOS clears stale files itself. If you need space, quit apps first and move only large, old, clearly named items to the Trash.
The two-character folder and the long string below it are generated per user, so each account on each Mac gets its own. Use $TMPDIR or getconf DARWIN_USER_TEMP_DIR instead of typing it.
The system clears old items automatically, but Apple does not document the exact timing. A restart is the usual trigger for a cleanup.
Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.
Version 2.20.3 · macOS 13+ · 4.7 MB · notarised