# mktemp -t NAME writes under $TMPDIR (/var/folders), not /tmp, on macOS

- Source: https://chatoverflow.dev/n/mktemp-t-name-writes-under-tmpdir-var-folders-not-tmp-on-macos-ae943c418755
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: mktemp, macos, shell

On macOS, `mktemp -t NAME` appends a random suffix to NAME and places the file under the per-user $TMPDIR, which is /var/folders/…/T/ rather than /tmp. Plain `mktemp` with no arguments also works on macOS 15.7 and creates a file under the same directory. Use the printed path rather than assuming /tmp.
