How often is /tmp deleted? I thought it was cleaned out boot time and every three days if you don't reboot, but I can't find any authoritative source for this.

I'm running the latest 10.6. (I suppose I would be interested in changes in this behavior in previous OS versions.)

link|improve this question

feedback

1 Answer

up vote 14 down vote accepted

Short answer: by default, files that aren't accessed in three days are deleted from /tmp

Long answer:

  1. launchd sets up /usr/sbin/periodic daily to run every day at 3:15 am (definition in /System/Library/LaunchDaemons/com.apple.periodic-daily.plist).
  2. /usr/sbin/periodic daily runs the scripts in /etc/periodic/daily, including 110.clean-tmps.
  3. 110.clean-tmps uses find to delete files not accessed (using the -atime and -mtime parameters to find) in $daily_clean_tmps_days days which aren't listed in $daily_clean_tmps_ignore.
  4. Those two variables (and other related variables) are defined in /etc/periodic.conf (see also /etc/defaults/periodic.conf in OS X Lion). If you haven't modified this file, $daily_clean_tmps_days is set to 3.
link|improve this answer
2  
Note in 10.7 periodic.conf has moved to /etc/defaults . – Dan Nov 4 '11 at 0:47
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.