tmpdir: more cross platform solution, and .txt file ending
darwin: allow for gnu mktemp in path