In macOS, how often is /tmp deleted?











up vote
83
down vote

favorite
26












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




    How about the per-user temporary folders in /var/folders/ ?
    – adib
    Sep 10 at 23:12















up vote
83
down vote

favorite
26












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




    How about the per-user temporary folders in /var/folders/ ?
    – adib
    Sep 10 at 23:12













up vote
83
down vote

favorite
26









up vote
83
down vote

favorite
26






26





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















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







macos






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 2 '17 at 18:29

























asked Sep 10 '10 at 15:31









zekel

6011912




6011912








  • 1




    How about the per-user temporary folders in /var/folders/ ?
    – adib
    Sep 10 at 23:12














  • 1




    How about the per-user temporary folders in /var/folders/ ?
    – adib
    Sep 10 at 23:12








1




1




How about the per-user temporary folders in /var/folders/ ?
– adib
Sep 10 at 23:12




How about the per-user temporary folders in /var/folders/ ?
– adib
Sep 10 at 23:12










1 Answer
1






active

oldest

votes

















up vote
104
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



















  • 9




    Note in 10.7 periodic.conf has moved to /etc/defaults .
    – Dan
    Nov 4 '11 at 0:47






  • 1




    Does the same apply to $TMPDIR?
    – ccnokes
    Jul 28 '16 at 21:38






  • 1




    No, I don't believe that it does. There's no reference to $TMPDIR in any of the config files mentioned.
    – Doug Harris
    Jul 29 '16 at 17:12










  • I have some indications that files are also cleared from /tmp on restart of the machine (I had a few gig of Blender renderings in /tmp that went poof and I think that they left this world when I restarted the machine)
    – Reb.Cabin
    Aug 21 '17 at 22:50










  • n.b. This answer is 7.5 years old at this point, macOS is now at 10.13 and I'm using 10.11. While the short answer is still correct (3 days), some of the details have definitely changed. For example, in 10.11, I don't see the line that schedules this for 3:15 a.m. in /System/Library/LaunchDaemons/com.apple.periodic-daily.plist. I've not had the time to learn more about the boot process to determine how /tmp is cleared at boot time (per the comment by @Reb.Cabin above)
    – Doug Harris
    Feb 16 at 14:59













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f187071%2fin-macos-how-often-is-tmp-deleted%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
104
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



















  • 9




    Note in 10.7 periodic.conf has moved to /etc/defaults .
    – Dan
    Nov 4 '11 at 0:47






  • 1




    Does the same apply to $TMPDIR?
    – ccnokes
    Jul 28 '16 at 21:38






  • 1




    No, I don't believe that it does. There's no reference to $TMPDIR in any of the config files mentioned.
    – Doug Harris
    Jul 29 '16 at 17:12










  • I have some indications that files are also cleared from /tmp on restart of the machine (I had a few gig of Blender renderings in /tmp that went poof and I think that they left this world when I restarted the machine)
    – Reb.Cabin
    Aug 21 '17 at 22:50










  • n.b. This answer is 7.5 years old at this point, macOS is now at 10.13 and I'm using 10.11. While the short answer is still correct (3 days), some of the details have definitely changed. For example, in 10.11, I don't see the line that schedules this for 3:15 a.m. in /System/Library/LaunchDaemons/com.apple.periodic-daily.plist. I've not had the time to learn more about the boot process to determine how /tmp is cleared at boot time (per the comment by @Reb.Cabin above)
    – Doug Harris
    Feb 16 at 14:59

















up vote
104
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



















  • 9




    Note in 10.7 periodic.conf has moved to /etc/defaults .
    – Dan
    Nov 4 '11 at 0:47






  • 1




    Does the same apply to $TMPDIR?
    – ccnokes
    Jul 28 '16 at 21:38






  • 1




    No, I don't believe that it does. There's no reference to $TMPDIR in any of the config files mentioned.
    – Doug Harris
    Jul 29 '16 at 17:12










  • I have some indications that files are also cleared from /tmp on restart of the machine (I had a few gig of Blender renderings in /tmp that went poof and I think that they left this world when I restarted the machine)
    – Reb.Cabin
    Aug 21 '17 at 22:50










  • n.b. This answer is 7.5 years old at this point, macOS is now at 10.13 and I'm using 10.11. While the short answer is still correct (3 days), some of the details have definitely changed. For example, in 10.11, I don't see the line that schedules this for 3:15 a.m. in /System/Library/LaunchDaemons/com.apple.periodic-daily.plist. I've not had the time to learn more about the boot process to determine how /tmp is cleared at boot time (per the comment by @Reb.Cabin above)
    – Doug Harris
    Feb 16 at 14:59















up vote
104
down vote



accepted







up vote
104
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














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














share|improve this answer



share|improve this answer








edited Aug 19 '14 at 11:02









Community

1




1










answered Sep 10 '10 at 17:26









Doug Harris

20.1k1462103




20.1k1462103








  • 9




    Note in 10.7 periodic.conf has moved to /etc/defaults .
    – Dan
    Nov 4 '11 at 0:47






  • 1




    Does the same apply to $TMPDIR?
    – ccnokes
    Jul 28 '16 at 21:38






  • 1




    No, I don't believe that it does. There's no reference to $TMPDIR in any of the config files mentioned.
    – Doug Harris
    Jul 29 '16 at 17:12










  • I have some indications that files are also cleared from /tmp on restart of the machine (I had a few gig of Blender renderings in /tmp that went poof and I think that they left this world when I restarted the machine)
    – Reb.Cabin
    Aug 21 '17 at 22:50










  • n.b. This answer is 7.5 years old at this point, macOS is now at 10.13 and I'm using 10.11. While the short answer is still correct (3 days), some of the details have definitely changed. For example, in 10.11, I don't see the line that schedules this for 3:15 a.m. in /System/Library/LaunchDaemons/com.apple.periodic-daily.plist. I've not had the time to learn more about the boot process to determine how /tmp is cleared at boot time (per the comment by @Reb.Cabin above)
    – Doug Harris
    Feb 16 at 14:59
















  • 9




    Note in 10.7 periodic.conf has moved to /etc/defaults .
    – Dan
    Nov 4 '11 at 0:47






  • 1




    Does the same apply to $TMPDIR?
    – ccnokes
    Jul 28 '16 at 21:38






  • 1




    No, I don't believe that it does. There's no reference to $TMPDIR in any of the config files mentioned.
    – Doug Harris
    Jul 29 '16 at 17:12










  • I have some indications that files are also cleared from /tmp on restart of the machine (I had a few gig of Blender renderings in /tmp that went poof and I think that they left this world when I restarted the machine)
    – Reb.Cabin
    Aug 21 '17 at 22:50










  • n.b. This answer is 7.5 years old at this point, macOS is now at 10.13 and I'm using 10.11. While the short answer is still correct (3 days), some of the details have definitely changed. For example, in 10.11, I don't see the line that schedules this for 3:15 a.m. in /System/Library/LaunchDaemons/com.apple.periodic-daily.plist. I've not had the time to learn more about the boot process to determine how /tmp is cleared at boot time (per the comment by @Reb.Cabin above)
    – Doug Harris
    Feb 16 at 14:59










9




9




Note in 10.7 periodic.conf has moved to /etc/defaults .
– Dan
Nov 4 '11 at 0:47




Note in 10.7 periodic.conf has moved to /etc/defaults .
– Dan
Nov 4 '11 at 0:47




1




1




Does the same apply to $TMPDIR?
– ccnokes
Jul 28 '16 at 21:38




Does the same apply to $TMPDIR?
– ccnokes
Jul 28 '16 at 21:38




1




1




No, I don't believe that it does. There's no reference to $TMPDIR in any of the config files mentioned.
– Doug Harris
Jul 29 '16 at 17:12




No, I don't believe that it does. There's no reference to $TMPDIR in any of the config files mentioned.
– Doug Harris
Jul 29 '16 at 17:12












I have some indications that files are also cleared from /tmp on restart of the machine (I had a few gig of Blender renderings in /tmp that went poof and I think that they left this world when I restarted the machine)
– Reb.Cabin
Aug 21 '17 at 22:50




I have some indications that files are also cleared from /tmp on restart of the machine (I had a few gig of Blender renderings in /tmp that went poof and I think that they left this world when I restarted the machine)
– Reb.Cabin
Aug 21 '17 at 22:50












n.b. This answer is 7.5 years old at this point, macOS is now at 10.13 and I'm using 10.11. While the short answer is still correct (3 days), some of the details have definitely changed. For example, in 10.11, I don't see the line that schedules this for 3:15 a.m. in /System/Library/LaunchDaemons/com.apple.periodic-daily.plist. I've not had the time to learn more about the boot process to determine how /tmp is cleared at boot time (per the comment by @Reb.Cabin above)
– Doug Harris
Feb 16 at 14:59






n.b. This answer is 7.5 years old at this point, macOS is now at 10.13 and I'm using 10.11. While the short answer is still correct (3 days), some of the details have definitely changed. For example, in 10.11, I don't see the line that schedules this for 3:15 a.m. in /System/Library/LaunchDaemons/com.apple.periodic-daily.plist. I've not had the time to learn more about the boot process to determine how /tmp is cleared at boot time (per the comment by @Reb.Cabin above)
– Doug Harris
Feb 16 at 14:59




















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f187071%2fin-macos-how-often-is-tmp-deleted%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Index of /

Tribalistas

Listed building