I notice that even when my Mac machine is not restarted. Files in /tmp more than a few days will disappear. Does macOS periodically purge files in /tmp?

My macOS is 11.4.

  • 4
    Use the source, Luke: /etc/periodic/daily/110.clean-tmps !
    – aMike
    Commented Mar 26, 2022 at 15:54

3 Answers 3


The answer here suggests that the periodic daily script indeed deletes older files in /tmp.

It is triggered by /System/Library/LaunchDaemons/com.apple.periodic-daily.plist which seems to run /usr/sbin/periodic daily (via a wrapper).

From the configuration file (/etc/defaults/periodic.conf):

# 110.clean-tmps
daily_clean_tmps_enable="YES"           # Delete stuff daily
daily_clean_tmps_dirs="/tmp"            # Delete under here
daily_clean_tmps_days="3"               # If not accessed for
daily_clean_tmps_ignore=".X*-lock .X11-unix .ICE-unix .font-unix .XIM-unix"
daily_clean_tmps_ignore="$daily_clean_tmps_ignore quota.user quota.group"
                                        # Don't delete these

So anything which hasn't been accessed in the last three days will be deleted (unless it matches a name in daily_clean_tmps_ignore).


There is this Apple document, which states the following:

  • /tmp

    This directory is used for general shared temporary storage. It is cleared out each time the system starts up.

  • /var/tmp

    This directory is used for general shared temporary storage. Although you should not count on data stored in this directory being permanent, unlike /tmp, the /var/tmp directory is currently not cleared out on reboot.

Note: The document is Copyright © 2016 by Apple Inc, which makes the information about 6 years old at the time this answer was posted.

Other References

  • 1
    Although the document is old and in an archive area it is still probably current as Apple has not produced any general documentation since moving these to an archive, ie nothing has replaced them. Also the Unix underpinnings have been there since 1990 and I don't think have chnaged.
    – mmmmmm
    Commented Mar 26, 2022 at 16:21
  • Is the difference between /tmp and /var/tmp specific to Apple's unix? Or it applies to other variant of UNIX, like Linux, etc.? Commented Mar 27, 2022 at 12:55
  • The difference between /tmp and /var/tmp is not specific to Apple's Unix. See Other References in my updated answer. Commented Mar 28, 2022 at 8:58

Even though the periodic.conf(5) manual page suggests that the daily_clean_tmps_enable option exists to control whether /tmp is periodically cleaned, it seems to have been removed in macOS 14.0.

Instead, there is a new tmp_cleaner script in /usr/libexec/tmp_cleaner that achieves the same thing. It does not appear configurable however.

To disable periodic cleaning of the /tmp directory, run the following command:

sudo launchctl disable system/com.apple.tmp_cleaner

On versions before macOS 14.0, one can configure periodic.conf to prevent cleaning:

echo 'daily_clean_tmps_enable="NO"' | sudo tee /etc/periodic.conf

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .