Where’s the Temp Folder on Mac OS? How to Find & Open the Mac Temporary Directory

Aug 17, 2018 - 4 Comments

Where the TEMP Folder is located on Mac

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:

  1. Open the Terminal application, found in /Applications/Utilities/ and type the following command string:
  2. echo $TMPDIR

  3. 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
/var/folders/g7/7du81ti_b7mm84n184fn3k910000lg/T/

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:

TMPDIR=/var/folders/g7/2du11t4_b7mm24n184fn1k911300qq/T/

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:

  1. From the Terminal application, type the following command string:
  2. open $TMPDIR

  3. Hit Return and a new Finder window with the $TMPDIR will open immediately

Opening the System Temp Folder on Mac

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:

cd $TMPDIR

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:

/tmp

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:

~/Library/Caches/TemporaryItems/

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!

.

Related articles:

Posted by: Paul Horowitz in Command Line, Mac OS, Tips & Tricks, Troubleshooting

4 Comments

» Comments RSS Feed

  1. Alan says:

    Thanks! Easily understood

  2. David Smith says:

    OS Big Sur 11.2.2: Just do it manually opening folders in the following sequence:
    [Your] Mac — private — var — folders — 05 — 6qkzjs945bcp8ywnlgx753m0000gn — T — com.microsoft.Outlook — Outlook Temp.
    Voilá!

  3. Valentino says:

    On a side note if I may..Mohave here installed, anyone would have any idea how I can reset Safari completely, not from the clean history, etc…like Delete the preference file which would bring the default page/size options like the first time that I opened the Safari browser.

    I just can’t find that .plist file anywhere, like I did it in the past, how do I access that file/folder?

    Thanks anyone for the answer/hint.

  4. Lasse says:

    In Finder > Hit cmd + shift + dot, and you can navigate in Finder to tmp folder (Startup disk name > private > tmp)

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site