How do I find out the system temporary directory?

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

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