WindowsmacOSLinux

Where Are Temporary Files Stored?

Where temporary files go on Windows, macOS and Linux, why Unix systems clear theirs automatically, and what breaks if you empty them early.

Last updated

Programs write scratch data constantly. Installers unpack here, browsers stage downloads here, apps stash half-finished work here. The folder is picked by the system and handed to programs through an environment variable, so the path varies by platform and by user.

Windows and Linux hold onto temp files until something cleans them, while macOS gives every login session its own private temp folder and wipes it on reboot. That difference matters more than the exact path.

There is one trap worth knowing before you empty anything. A running installer extracts files into the temp folder and reads them back during setup, so clearing it mid-install breaks the setup halfway through.

Where Temp Folders stores this, by platform

Windows
C:\Users\[Username]\AppData\Local\Temp

This is where %TEMP% and %TMP% point for your account, and typing %temp% into the Run box opens it. The system-wide equivalent is C:\Windows\Temp, which needs admin rights and is used by services and elevated installers. Windows never empties this folder on its own, so it grows until you or Storage Sense clean it out.

macOS
/var/folders/.../T/

Each login session gets its own random directory under /var/folders, exposed to programs as the $TMPDIR variable (run echo $TMPDIR to see yours). macOS prunes these automatically and clears them on reboot, so there is rarely much worth cleaning by hand. /tmp is a symlink to /private/tmp for anything shared between users, and it is emptied at boot too.

Linux
/tmp

The default whenever $TMPDIR is not set, shared by all users and usually wiped at boot: many distros mount it as tmpfs in RAM, others prune it with systemd-tmpfiles. Longer-lived scratch files belong in /var/tmp, which deliberately survives reboots. Programs that want a private space set $TMPDIR and ignore both.

Frequently asked questions

Is it safe to delete temporary files?

Usually, yes, once no installers or heavy programs are running. Files in use will refuse to be deleted, and it is fine to skip those. On Windows, Disk Cleanup or Storage Sense does the job more safely than a blanket select-all in %TEMP%.

Why does the temp folder keep filling up?

Because Windows never clears %TEMP% by itself, and crashed programs leave their files behind. Turn on Storage Sense under Settings > System > Storage, or run Disk Cleanup every so often. macOS and Linux clean these folders on their own, so this is mostly a Windows problem.

Where do installers put temporary files?

Most Windows installers extract into %TEMP% under a random folder name while setup runs, then delete it on success. When setup crashes halfway, that folder is often left behind. Never empty %TEMP% during an install, because the setup program still needs what it unpacked there.

Notice an outdated path? Let us know.