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.

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

2 Answers 2


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

  • at least on Linux /tmp is deleted on every reboot, idk if MacOS does that but it wouldn't surprise me
    – hanshenrik
    Mar 28 at 7:58
  • One weird thing about the periodic clean-up is that, only files are removed, but directories are left alone (at least on my machine). Is it expected? Jul 23 at 20:38

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
    Mar 26 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.? Mar 27 at 12:55
  • The difference between /tmp and /var/tmp is not specific to Apple's Unix. See Other References in my updated answer. Mar 28 at 8:58

You must log in to answer this question.

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