26

I would like to know where is the folder of temporary files in system. For example, in Windows is the folder:

C:\Documents and Settings\Administrador\Configuración local\Temp

3
  • 1
    launchd and some other daemons use /private/tmp/ and /var/tmp for temporary files and sockets. /tmp is a symlink to /private/tmp.
    – jaume
    Commented Jun 26, 2013 at 14:16
  • Thanks friend! What is the difference between /private/tmp and /var/tmp?? Commented Jun 26, 2013 at 14:24
  • 2
    As a general rule, /tmp is wiped upon reboot, while /var/tmp is not.
    – jaume
    Commented Jun 26, 2013 at 14:39

4 Answers 4

34

OS X generates a programmatic directory stored in /private/var and defines the $TMPDIR environment variable for locating the system temporary folder.

Using Terminal.app, type echo $TMPDIR or open $TMPDIR (to open Finder on that folder).

There you will find temp files stored by the Applications running.

Source: https://superuser.com/questions/581347/where-is-the-temp-folder-inos-x

Since OS X is based on UNIX, there are several types of temporary directories, in addition the the "system" one where it stores things.

  • $TMPDIR which is generated like /var/folders/xl/84p38nhj405frmrkdpqb3v9c0000gn/T/
  • /private/tmp
  • /private/var/tmp
  • /private/var/at/tmp
  • /private/var/spool/cups/tmp
2
  • Isn't /var identical to /private/var?
    – Pacerier
    Commented Mar 3, 2022 at 2:37
  • 1
    If you run a ls -la / you will see that var -> private/var. My answer is from 2014, so I can't really tell if that was the case back then. Still /var is just a link to real folder /private/var, probably to fulfill unix's conventions. Commented Mar 4, 2022 at 14:29
2

Your question has a false premise that there IS a "temp" folder. This isn't Windows, and the Unix architecture of Mac OS X is entirely different. Temp folder for what? For some low level junk, there's /tmp and /var/tmp. For Application preferences there's ~/Library/Preferences, for Application caches and temp files, there's ~/Library/Application\ Support.

A clearer answer would be possible if you specified the particular task you're trying to accomplish.

6
  • 17
    I think the OP is not trying to accomplish any task but rather wants to understand how OS X works. He's specifically asking for the equivalent of %USERPROFILE%\Local Settings\Temp (%USERPROFILE%\AppData\Local\Temp on Vista and newer), not %USERPROFILE%\AppData\Local\Temporary Internet Files or the like. That's probably /tmp (symlink to /private/tmp) and /var/tmp, the difference being that /tmp gets wiped clean at startup. I wouldn't say ~/Library/Application Support and ~/Library/Preferences are temp folders as apps use them to save persistent data like state and settings.
    – jaume
    Commented Jun 27, 2013 at 10:02
  • Are you saying that there isn't a temp folder? Your answer would be refuted by this superuser.com/questions/581347/where-is-the-temp-folder-in-os-x which also makes this question a duplicate.
    – Allan
    Commented Mar 10, 2016 at 18:54
  • 1
    @Allan Did you at all read my post?
    – Alexander
    Commented Mar 15, 2016 at 2:32
  • 3
    @Alexander No need to be condescending towards new users. As you've listed out many examples of what a program might use a temporary directory for, you might as well list them all out in a style like lucasarruda's answer.
    – Ky -
    Commented Feb 28, 2018 at 15:25
  • @Alexander, isn't /tmp identical to /private/tmp?
    – Pacerier
    Commented Mar 3, 2022 at 2:36
0

/tmp is the general location for temporary files in Mac OS X, as well as most UNIX-like systems.

2
  • 2
    There is also $TMPDIR.
    – lhf
    Commented Jun 26, 2013 at 16:03
  • 2
    $TMPDIR is an environment variable that points to a temporary directory like /tmp, not a temporary directory itself. You can set $TMPDIR to any value you want (and it will work as long as the directory exists and has the sticky bit set).
    – jaume
    Commented Jun 27, 2013 at 10:21
0

The temporary directory for user specific temp files is given by the environment variable TMPDIR. This is under /var/tmp On my Yosemite login it is TMPDIR=/var/folders/11/d839g3h52m55ps0l8f621b8m0000gp/T/

1
  • 1
    Note that this also changes periodically. I haven't found any consistent behavior, which I suppose is good, if what you're storing in these folders truly is ephemeral.
    – Ky -
    Commented Feb 28, 2018 at 15:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .