0

I've read that /tmp will automatically have files deleted that are older than 7 days or upon restart, but I can't seem to find where this is documented. Can anyone point me to a man or web page from Apple?

Chuck
  • 1,780
  • good question, but what is it for? just knowledge or a problem to be solved. – Ruskes Jul 09 '14 at 10:34
  • @Buscar: Well, if I find the documentation on it I was going to see if what I read was accurate and if the age before deletion was customizable. But that's secondary to my curiosity about it. I figure it's got to be documented somewhere, but I don't know where. – Chuck Jul 09 '14 at 11:03
  • @Mark: This isn't a duplicate. I've read that question and it asks nothing about the location of /tmp's documentation, although given what that poster said, my source for files being deleted after 7 days appears to be incorrect. – Chuck Jul 09 '14 at 11:05
  • The other question's answer does give the documentation it is the code – mmmmmm Jul 09 '14 at 11:07
  • The only code I see is /etc/defaults/periodic.conf, which is the location of a configuration file (which I did a cat on, just in case), not a documentation file. man periodic says nothing about /tmp. Am I missing something that you're seeing? – Chuck Jul 09 '14 at 11:12
  • 1
    Reading the config file lead me eventually to /etc/periodic/daily/110.clean-tmps, which, given the config file, ostensibly confirms that cleanup is supposed to happen to /tmp every 3 days, but it would seem that reading the bash scripts can't be the only place this is documented. – Chuck Jul 09 '14 at 11:27
  • 1
    For system-level stuff like this, reading the source code often is the best (and most accurate) documentation you can get. – nohillside Jul 09 '14 at 11:46

2 Answers2

3

There is a little documentation here on the background tasks that do things like clear up the /tmp folder, but it is marked as archived now and Apple don't seem to have released an updated version.

There should be a log at /var/log/daily.log for the daily script that (amongst other things) clears out the /tmp folder.

1

As @patrix pointed out, in cases like this, the source code is sometimes the best documentation, perhaps especially for interpreted (as opposed to compiled) software, so the documentation for this is currently found in /etc/periodic/daily/110.clean-tmps and /etc/defaults/periodic.conf.

Chuck
  • 1,780