When "/tmp" and $TMPDIR directory are cleaned up in macOS?
I know about removing files and directories in /tmp directory in boot time. Is it right?
In addition, are there other times in trying to clean up the directory?
When "/tmp" and $TMPDIR directory are cleaned up in macOS?
I know about removing files and directories in /tmp directory in boot time. Is it right?
In addition, are there other times in trying to clean up the directory?
Thanks for the explanation.
The temporary directory cleanup is actually run by infrastructure inherited from BSD. You can read about it in the
periodic.conf man page and by reading
/etc/periodic/daily/110.clean-tmps and
/etc/defaults/periodic.conf. It looks like
daily_clean_tmps_days defaults to 3, meaning that a file gets deleted if it hasn’t been
accessed in three days.
Keep in mind that the specific details aren’t considered API, and can vary from release to release and platform to platform. For example, iOS has a very different system for handling temporary files.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
@eskimo It doesn't look to me like $TMPDIR is referenced in periodic.conf by default only /tmp is.
Why do you care? Specifically, are you asking from an API perspective (as a developer, when is it safe to leave files in the temporary directory?) or from a user perspective (when will the system recover that disk space?).
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
My app creates and check some files in "/tmp" or $TMPDIR.
It's because files tried to be saved in user selective path are stored temporary and because some files to be used flags whether my app logs its status or not. To protect human error, for example, our supporter team's forgetting removing a log flag file, there files stores in /tmp or $TMPDIR
So, for app's operations and maintenace, I wanna know the time.
If only every boot time, I'm OK. But not, there are somethings to be considered such as safer code and explaining these things to techincal support team and testers who want to log my app status long time.
Thanks for the explanation.
The temporary directory cleanup is actually run by infrastructure inherited from BSD. You can read about it in the
periodic.conf man page and by reading
/etc/periodic/daily/110.clean-tmps and
/etc/defaults/periodic.conf. It looks like
daily_clean_tmps_days defaults to 3, meaning that a file gets deleted if it hasn’t been
accessed in three days.
Keep in mind that the specific details aren’t considered API, and can vary from release to release and platform to platform. For example, iOS has a very different system for handling temporary files.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
@eskimo It doesn't look to me like $TMPDIR is referenced in periodic.conf by default only /tmp is.
Thank you!!
they get cleaned along with a lot of other crap every time i run my bash script, sudo **** garbage
1 cleans out the internet cache,
2 rebuild the mail database, delete downloaded just
3 nukes every .DS_Store on any drive
4. nukes every .Trash on every drive
you should just download Onyx, Maintenance or Deeper
@eskimo It doesn't look to me like $TMPDIR is referenced in periodic.conf by default; only /tmp is.
You would have to override daily_clean_tmps_dirs to include it.