Sign up ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm testing an app that uses the System temp Directory. Inside of the app, there is some call to a Cocoa function to query this. Is there a way for me to query for this directory name outside of having to write a Cocoa app of my own? Possibly a command that I can issue in Terminal?

share|improve this question
I found this answer great plus it works on Linux platforms too (probably not a huge concern for you, I realise): – Tom Saleeba Oct 22 at 9:46

2 Answers 2

up vote 10 down vote accepted

Just type this command into Terminal. With zero arguments it'll print the names and values of variables in the environment.

Alternative with a bit more typing:

echo $TMPDIR
share|improve this answer
Thanks. What a weird path - /var/folders/iz/izqn2b5MF-iz9oL0CURH1U+++TI/-Tmp-/ – bpapa Nov 13 '10 at 20:32

OS X has Python pre-installed, though not necessarily a fresh Python; but this is not cutting-edge stuff.


Open a terminal

cat >
import tempfile
print tempfile.gettempdir()

Credit to nosklo

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.