I've MAMP running httpd
server as _www and I'd like to assign the temporary directory as part of the shell script (bash).
I've tried to use $TMPDIR
as per these posts:
however it points to /var/folders/vp/tlt7xf791gl1_v56m0xdmrph0000gn/T/
and this folder has not necessary permissions, so Apache server can't create any files in there.
Based on this:
$ /usr/bin/stat -F $TMPDIR /tmp /private/tmp
drwx------ 104 kenorb staff 3536 Oct 14 22:21:05 2015 /var/folders/vp/tlt7xf791gl1_v56m0xdmrph0000gn/T//
lrwxr-xr-x 1 root wheel 11 Apr 9 13:08:03 2014 /tmp@ -> private/tmp
drwxrwxrwt 112 root wheel 3808 Oct 14 22:12:04 2015 /private/tmp/
My www user which I care about:
$ id _www
uid=70(_www) gid=70(_www) groups=70(_www),12(everyone),61(localaccounts),401(com.apple.sharepoint.group.1),100(_lpoperator)
I can't use /tmp
, because it's linked to my /private/tmp
(which name states it's private).
Therefore how do I determine my correct temporary directory on OS X, so I and my httpd
server can use it?
I don't want to hardcode value, as the script would be useless when used on different environments (e.g. on non-MAMP environment), so the location can vary.