Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.)

share|improve this question

1 Answer 1

up vote 42 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. (Since OS 10.7 there is a file /etc/defaults/periodic.conf which defines the defaults, but for overwriting these defaults you should still create /etc/periodic.conf – see the periodic.conf(5) manual page.) If you haven't modified this file, $daily_clean_tmps_days is set to 3.
share|improve this answer
4  
Note in 10.7 periodic.conf has moved to /etc/defaults . –  Dan Nov 4 '11 at 0:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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