Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the differences between these directories?
How long is the files stored in each of them?

The oldest file/folder I could find in each of them were

  • /prviate/tmp, 13 days old
  • /private/var/tmp, 28 days old (2-3 days after I upgraded to Lion)
  • TMPDIR, 1 day old

Note: TMPDIR is what you get when running echo $TMPDIR in Terminal. My TMPDIR is /var/folders/3y/d44gn_2x7vv8d9d67969f54c0000gn/T/

share|improve this question
Good question. I just checked and I think /private/var/tmp sticks around longer because I have stuff in there from over a year ago. – styfle Aug 21 '11 at 3:16
up vote 10 down vote accepted

TMPDIR as defined in OSX is only accessible by yourself which reduces the risk of somebody else accessing your temp files created by programs using mktemp() to create temporary files.

The difference between /tmp and /var/tmp is more subtle and goes back a long way in the Unix world, the discussion concerning the differences and uses are probably going on since the first Unix system was deployed with both (see Google for long list of links). /tmp resides on the root filesystem so it it accessible as soon as the system starts (even if no other disk is mounted yet) but may be rather small. The /var filesystem usually is in another partition and much bigger. I've also encountered systems where /tmp was just a ramdisk or a symlink to /var/tmp. It's not that way on OSX though.

/tmp is cleared out regularly on OSX (see /etc/defaults/periodic.conf), /var/tmp very rarely (if at all).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.