1

This seems to work as a temporary folder in Apple Script

path to temporary items

but

path to temporary items from user domain

is also recommended to use.

Which one is correct and safe to use? I am confused by the web references.

1 Answer 1

1

If you don't want or need those temporary files to be available to all users, then definitely using "from user domain" is ideal. If you require the files to be available to all users, then you should use the plain "path to temporary items".

5
  • Thanks. Whats is the life time of these objects? Do they clear themselves or user interaction is needed?
    – Jessia
    Feb 3, 2016 at 18:25
  • They do indeed clear themselves, at least in the root domain. I'm not certain when temporary files in the user domain clear themselves, but in the root domain, they will clear after a reboot, so this is likely the same case in user domain. OS X will clear its root tmp directory once every day using its daily maintenance script, but it doesn't seem to touch the user's directory, so you may have to manage this on your own. Feb 3, 2016 at 18:33
  • Another fun fact: You can see which directory the daily maintenance script will clean by running this command grep daily_clean_tmps_dirs /etc/defaults/periodic.conf Feb 3, 2016 at 18:39
  • Thanks again. "user domain" should also help solving privilege issues, right? I will pass the script to users and I can not make sure they are root or restricted user. I do not want folder write restriction issues. I hope user domain also works for root or administrator.
    – Jessia
    Feb 3, 2016 at 18:51
  • @Jessia Oh, it'll work as root, assuming you don't need the files to be available to multiple users. The interesting thing is that the path to root's temporary items (if you use "with user domain") is "Macintosh HD:private:var:root:Library:Caches:TemporaryItems:", rather than "Macintosh HD:private:var:folders:", etc. Feb 3, 2016 at 19:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .