When I create a random file on macOS with mktemp I get:
mktemp /tmp/test.XXXXXXX.json
mktemp: mkstemp failed on /tmp/test.XXXXXXX.json: File exists
It does not replace XXXXXXX with random string. Works fine on Linux but not on macOS.
On
This is the documented behaviour, from man mktemp:
The template may be any file name with some number of `Xs' appended to it, for example /tmp/temp.XXXXXX
Turns out, for whatever reason, macOS version of
mktempsupports only trailingXXXXXXfor random string, in other wordsmktemp /tmp/test.XXXXwill work but not/tmp/test.XXXX.json