Where’s the Temp Folder on Mac OS? How to Find & Open the Mac Temporary Directory
The Mac operating system has several system level temporary folders which contain temp files used by MacOS itself along with various Mac apps. This temp folders are not intended to be user facing, but in some rare situations an advanced Mac user may find themselves requiring to locate the temp folder and maybe even to muck around in there, whether for systems administration purposes, troubleshooting, digital forensic purposes, or another specific reason.
This tutorial will show you where the temp folders are located on Mac OS and how you can access them.
This probably goes without saying, but this is aimed only at advanced Mac users. Almost nobody should dig around in the temp directories of macOS / Mac OS X, and you should not attempt to manually delete or remove any data from any of the tmp directories, as you may break something or completely screw up your system installation, or an app, or even active document data, thereby incurring data loss, or requiring reinstalling Mac OS X / or reinstalling macOS, or restoring from a backup. If for whatever reason you want to clear out the temporary items files on a Mac, simply reboot the computer to target system level temp files, while user level caches and temp files can be manually cleaned out if necessary for some reason or another.
Again, do not attempt to manually modify anything and do not delete any files found in the Mac OS system temp folders. If you somehow screw up and delete a critical system file or directory, you’ll have to follow these instructions to restore deleted system files by reinstalling core macOS system software.
How to Find Where the Temp Folder in Mac OS is Located
The simplest way to find where the Temp Folder of MacOS / Mac OS X is located is to use the echo command on the $TMPDIR environmental variable at the command line:
- Open the Terminal application, found in /Applications/Utilities/ and type the following command string:
- The command output will be the Mac temporary directory
TMPDIR will always be a path to a seemingly nonsensical directory structure, because it is not intended to be user facing or user serviced, it’s a temp system folder afterall.
For example, using the above command you might see something like the following as the command output for echo $TMPDIR:
$ echo $TMPDIR
In this case, the path to the macOS temp folder is “/var/folders/g7/7du81ti_b7mm84n184fn3k910000lg/T/”
To be thorough, you can also use printenv to print environmental variables and use grep like so:
printenv |grep TMP
This will also reveal the same TMPDIR path by printing out something like the following:
How to Access & Open the Temp Folder in Mac OS
You can instantly access and open the Temp folder in a new Mac OS Finder window by using the ‘open’ command and pointing it at the environmental variable $TMPDIR like so:
- From the Terminal application, type the following command string:
- Hit Return and a new Finder window with the $TMPDIR will open immediately
Notably, $TMPDIR is not protected by System Integrity Protection (meaning whether SIP is enabled or disabled you can still modify, edit, delete, and write to that directory), so be cautious as many files and items in the $TMPDIR will be actively used by currently open applications. Within $TMPDIR you’ll find all sorts of media caches and other files. As mentioned before, do not manually modify or delete anything in these directories unless you know exactly what you’re doing.
Alternatively, you can also change the current working directory at the command lien to the temporary directory from the command line with a simple cd command:
The $TMPDIR is just like any other directory
Other MacOS Temporary Directories
Another temporary directory in Mac OS is universal to all users, found at the following location:
For what it’s worth, /tmp in Mac OS actually just links to /private/tmp/ , so you can also just navigate to /private/tmp/ to find the same data, whether it’s a bunch of caches or contents of a ram disk or anything else contained therein.
There are also various user level temporary folders, like the user ~/Library/Caches/ caches folder, and some apps also have specific temporary directories, for example Outlook has a temp folder, as does the Mac App Store (which is tucked into $TMPDIR), and many Mac apps dump temporary files in the user level cache directory.
The primary user temporary folder is located at:
As already mentioned, you should probably not attempt to delete or modify anything in the temp folders, no matter where they are, whether it’s in your user folder or $TMPDIR or elsewhere, as you can easily screw something up or end up with unintended results. If for whatever reason you are concerned about the $TMPDIR contents or other similar type of files and data, simply quitting all open apps, then restarting the Mac will clear out temporary items from /private/var/ folders and much of what’s found in $TMPDIR as well.
Do you know of any other helpful tips or tricks pertaining to the temp folder on Mac OS / Mac OS X? Share in the comments below!