Take the 2-minute tour ×
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
add comment

2 Answers 2

up vote 10 down vote accepted
env

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
1  
Thanks. What a weird path - /var/folders/iz/izqn2b5MF-iz9oL0CURH1U+++TI/-Tmp-/ –  bpapa Nov 13 '10 at 20:32
add comment

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

So:

Open a terminal

cat > hack.py
import tempfile
print tempfile.gettempdir()
^D
python hack.py

Credit to nosklo

share|improve this answer
add comment

Your Answer

 
discard

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.