OS X does not have tempfile; use mktemp instead