What a restart frees on a full Mac

8 min readMarkdownTiếng Việt

This post was written by AI: Claude Code (model Claude Opus 5.5) wrote it from my prompts. My idea, the prompts and what had to be fixed are at the end.

In short

  • Restarting, a fix from the early days of computers, still works for a Mac's disk: on 26 October 2026 my 228 GB MacBook was down to 121 MB free, and after a restart it had 37 GB. 121 MB free
  • A restart clears three things macOS keeps on disk for running apps: swap (memory written out from RAM to disk), temp folders, and files deleted while an app still holds them open. While those apps are running, no cleaner can safely remove any of them. Three things a restart clears
  • A Mac slows down on a nearly full disk partly because of swap: reading data back from swap is much slower than from RAM, and a full disk leaves swap no room to grow. When both RAM and the disk are full, macOS opens the Force Quit window and asks you to quit apps. Why a Mac slows down
  • Storage settings count swap, caches and temporary files under System Data, so System Data can be huge before a restart and shrink after it. System Data
  • Before restarting, you can check Swap Used in Activity Monitor and System Data in Storage settings; the rest is app data, and cdm can clean it. Checking your own Mac

A one-minute read. The rest goes into detail; pick a section from the contents.

Contents (7 sections)
  1. 121 MB free
  2. Three things a restart clears
  3. Why a Mac slows down when its disk is nearly full
  4. System Data in Storage settings
  5. Checking your own Mac
  6. Cleaning a Mac with cdm
  7. How this post was written

When a computer misbehaves, restart it. It’s a fix from the early days of computers, and people still ask why it works: the Quora question Why does restarting solve so many tech problems? has 82 answers. The usual explanation is that a restart clears the RAM and wipes the current state of the running software. An IT memes page on Facebook jokes that 90% of IT problems need only one button: Restart.

On the evening of 26 October 2026 the old fix worked again on my MacBook, this time for its disk: the 228 GB drive was down to 121 MB free, and a restart gave back about 36 GB. What came back was running software’s state too, only it was on disk. This post explains what that state is, why a Mac slows down when its disk is nearly full, why only a restart or quitting an app clears it, and how you can check it on your own Mac. The figures are from macOS 26.6, measured by Claude (an AI, running in Claude Code) while dealing with the full disk.

121 MB free

Around 22:00 that evening the Mac was running many Claude Code sessions and developer tools. A command Claude ran could not start because the disk was full, and a check showed only 121 MB free. Claude started measuring which folders were large, but before it finished, the Mac was restarted, at 22:12.

df, the command that shows disk usage, before and after the restart shows where the space went:

Before the restart (22:02) After the restart (22:26)
Swap about 14 GB 0
Used on the data volume 192 GB 170 GB
Free 121 MB 37 GB

The first two rows fell by about 36 GB in all, close to the free space gained. Over the next 25 minutes df went on to report 49 GB and then 59 GB free; the step from 49 to 59 GB came when another Claude session deleted a 10.6 GB Docker cache, which had nothing to do with the restart.

Three things a restart clears

All three are data that running apps use, and macOS keeps them on disk for as long as the apps need them.

Swap: memory written out from RAM to disk

RAM is the Mac’s working memory: open apps keep their data there. When apps need more memory than the Mac has, macOS writes memory that isn’t being used out to disk to make room for what is needed now, according to Apple’s documentation on virtual memory. That part on disk is called swap. The same page notes that macOS doesn’t set aside a fixed partition for swap but uses the free space on the startup disk, so every gigabyte of swap is a gigabyte less free space.

On this Mac, swap lives in its own volume named VM, mounted at /System/Volumes/VM, in the same APFS container as the volume that holds your data. Apple’s Disk Utility guide says the volumes in one container share its free space, so swap and your files draw on the same pool.

You can see swap in Activity Monitor, on the Memory tab, as Swap Used. Per Apple’s Activity Monitor guide, that is the space on your startup disk being used to swap data to and from RAM.

The bottom of Activity Monitor's Memory tab: a green Memory Pressure graph; Physical Memory 16,00 GB, Memory Used 14,22 GB, Cached Files 1,79 GB, Swap Used 5,73 GB
Activity Monitor's Memory tab on this Mac, about two and a half hours after the restart: Swap Used at 5.73 GB, memory pressure still green.

A restart empties RAM, so swap has nothing left to hold: after the 22:12 restart, swap on this Mac was 0. It comes back as apps fill memory again: 80 minutes later the swap files took up 7 GB of the disk again, almost 6 GB of it in use (the figure Activity Monitor shows as Swap Used).

Temp folders

Apps write temporary files, ones they need while working and then drop, to /tmp or to each user’s own temp folder under /var/folders. On macOS, /tmp is only a shortcut (symlink) to /private/tmp, an ordinary folder on the disk. It isn’t held in RAM the way /tmp is on some Linux systems: since Debian 13, for example, /tmp is by default stored in memory using tmpfs. Claude checked on this Mac: df /private/tmp shows the folder on the data volume, alongside your files, and no tmpfs or RAM disk is mounted. So temporary files take up disk space like any other file.

macOS’s hier manual page, which describes the system’s folders (run man hier in Terminal, or read a copy on the web), lists /tmp for temporary files, /var/folders for per-user temporary files and caches, and /var/tmp (that is, /private/var/tmp) for temporary files that are kept between restarts.

macOS cleans /private/tmp and the user’s temp folder in two ways:

  • Every day it deletes files that haven’t been used for 3 days. An Apple support engineer explains this on Apple’s developer forums, and notes that the details can differ between macOS releases.
  • At startup, /private/tmp is emptied. Claude found no Apple document that says so; the clearest source is a comment in Chromium’s source code. Claude checked after the restart: neither /private/tmp nor the user’s temp folder held anything older than the startup, while /private/var/tmp still had old files, as its hier entry says it should.

While the Mac is running, apps may still need the files in these folders, so deleting them by hand isn’t safe. At startup, no app is using them yet.

Deleted files still held open

Deleting a file on macOS removes its name from a folder. According to the manual page for unlink, the system call that deletes files, if a program still has the file open, its space is freed only once every program has closed it. Until then the file has no name in any folder, so neither Finder nor any cleaner that looks through folders can see it, yet it still takes up space. Quitting the app that holds it, or restarting, gives the space back. On this Mac after the restart, such files came to about 42 MB, held mostly by macOS background processes and Chrome.

In Terminal, lsof can list these files. Per lsof’s manual, +L1 selects open files that have been deleted, and -a makes it list only files that meet every condition (without it, the command lists every open file on the disk):

lsof -a -nP +L1 /System/Volumes/Data

Why a Mac slows down when its disk is nearly full

In its guide If your Mac runs slowly, Apple lists two causes that go together: the startup disk may not have enough free space, and an app may need more memory than your Mac has readily available. Swap ties the two together:

  • Once RAM is full, every time an app needs data that was moved out to swap, macOS has to read it back from disk. According to Apple’s virtual memory documentation, that is much slower than reading from RAM, and when there is too much swapping, the system spends a lot of its time reading and writing the disk instead of running programs. You see apps respond slowly.
  • Swap can only grow while the startup disk has free space. When the disk is nearly full, macOS has nowhere to move more data out to, while RAM is already full.
  • Apps also write temporary files, caches and your data while they run, and on a full disk those writes fail. On my Mac at 121 MB free, a command Claude ran couldn’t even start, because it couldn’t create the file that records its output.

When both RAM and the disk are full, macOS opens the Force Quit Applications window with the message “Your system has run out of application memory” and asks you to force quit apps. Apple has no support page for this message. A level 9 member of the Apple Community forums explains that one cause is a startup disk with so little free space that macOS can’t create swap files, and Switching To Mac writes that the Force Quit window shows this message when the Mac is close to its maximum memory capacity. According to Apple, quitting an app the normal way lets it do what it needs to before it closes, such as saving changes. So when the message appears, save your work and quit the apps that still respond the normal way before you use Force Quit, or restart.

In Activity Monitor, the Memory Pressure graph on the Memory tab shows how hard memory is working: per Apple, yellow means your Mac might eventually need more RAM, and red means it needs more RAM.

System Data in Storage settings

In System Settings > General > Storage (Apple’s guide), macOS breaks down used space by kind: Applications, Documents, Photos and so on, plus System Data. According to another Apple guide, System Data holds log files, caches, “VM files” (that is, swap), temporary files and other data the system uses while running. You can’t manage its contents, and its size varies with the current state of your Mac.

The category list in Storage settings: Applications 6,49 GB, Developer 1,41 GB, Documents 42,6 GB, iCloud Drive 84,3 MB, Mail 4,1 MB, Music 4,1 MB, Photos 15,4 MB, Other Users & Shared 54,58 GB, macOS 33,16 GB, System Data 52,25 GB
Storage settings on this Mac, nearly three hours after the restart. macOS took about 10 minutes to finish calculating Documents and System Data.

So on a Mac whose disk is full, much of what a restart clears sits in System Data. But System Data is more than swap and temp files: when the screenshot above was taken, System Data on this Mac was 52.25 GB, while the swap files took about 7 GB and the two temp folders less than 0.3 GB. If System Data is very large, check how much of it is swap before you go looking for files to delete.

Checking your own Mac

Before restarting a Mac that is running out of space:

  1. Open Activity Monitor, choose the Memory tab, and look at Swap Used and the Memory Pressure graph near the bottom of the window.
  2. Open System Settings > General > Storage and see how large System Data is.
  3. If you use Terminal, these three commands measure the three parts:
df -h /System/Volumes/VM
du -sh /private/tmp "$TMPDIR"
lsof -a -nP +L1 /System/Volumes/Data

The Used column of the first is swap, the second measures both temp folders, and the SIZE/OFF column of the third is the size of deleted files that apps still hold open (the COMMAND column says which app).

If swap is large, save your work and restart to get that space back. If most of it is deleted files held open, quitting the apps that hold them is enough.

Cleaning a Mac with cdm

Apart from those three, most of a disk is files from apps and tools, which have to be deleted as files, and much of that is caches that apps rebuild when they need them. I made cdm (CleanDevMac) to clean up things like these: it finds the caches of developer tools, browsers and apps, plus data left behind by apps you’ve removed, shows you each item and its size, then deletes only what you approve. It runs with one command in Terminal and needs no install:

curl -sSL https://github.com/cleandevmac/cdm/releases/latest/download/cdm | bash

Add -s -- -n to the end of the command for a preview that deletes nothing. The source is on GitHub, and the guide at cleandevmac.github.io.

How this post was written

A bonus for readers who got this far. Claude Code (model Claude Opus 5.5) wrote this post. Here are my idea, my main prompts (tidied up for reading) and what had to be fixed.

The idea

Restarting is the fix people have reached for since the early days of computers, and on 26 October 2026 it worked again on my Mac when the disk ran out of space. I wanted a post on what happened and what was learned that regular Mac users can follow, with a link proving each macOS mechanism, in Vietnamese with an English translation. This is the translation; Claude translated it from the Vietnamese post.

My prompts

  1. How can restarting the OS free about 20 GB of disk? Can that be added to this tool?

    Claude explained the three kinds of space a restart gives back, and checked on the Mac that both temp folders had been emptied at startup (three things a restart clears).

  2. Write a blog post in Vietnamese, with an English translation, about what happened, what was newly learned and what was applied to cdm.

    Claude wrote the Vietnamese post and this translation, and added a translationOf field so the two link to each other.

  3. I mean the fix people used all the time in the old days, "restart", which now works on a Mac again.

    The opening and the summary present restarting as an old fix that still works on a Mac.

  4. Check this, and this too. (Two screenshots of Google results: the Quora question "Why does restarting solve so many tech problems?", and the post "90% of IT problems are solved with one button: Restart" from an IT memes page on Facebook.)

    The opening cites the Quora question and the usual explanation: a restart clears the RAM and wipes the running software's state.

  5. Don't go into the details of cdm's updates; just say readers can use it to clean their Mac. Fix the writing style by learning from the existing posts. Each explanation of a system or macOS mechanism needs a link that proves it. Overall, the post should give regular users new information and be easy to understand.

    Claude dropped the sections on what changed in cdm and on the traps met while measuring the disk, rewrote the explanations starting from what RAM and swap are, linked each mechanism to Apple documentation, a manual page or Chromium's source, and added the sections on System Data and on checking your own Mac with Activity Monitor and Storage settings.

  6. Say more about why a Mac lags so badly when its disk is nearly full; could it be related to swap? And does a Mac ask you to force quit apps when both the disk and RAM are full?

    Added Why a Mac slows down when its disk is nearly full: per Apple's documentation, swap is slower than RAM and needs free disk space; the section also covers the Force Quit window with the message "Your system has run out of application memory". Apple has no support page for that message, so the post cites the Apple Community forums and Switching To Mac.

  7. The section "Những gì còn lại trên ổ đĩa" (What else fills the disk) doesn't seem needed.

    Removed that section and its table of the large items on the disk.

  8. Isn't `/private/tmp` mounted in RAM like `/tmp`? … Add that info to the post.

    Claude checked on the Mac: /tmp is a symlink to /private/tmp on the data volume, and no tmpfs or RAM disk is mounted. The Temp folders section now says so, citing macOS's hier manual page and the Debian 13 release notes.

  9. Add some images; you could take screenshots on my Mac.

    Claude captured the bottom of Activity Monitor's Memory tab and the category list in Storage settings on the Mac, leaving out the process list and the sidebar because they show account names, and added the two images to the Swap and System Data sections.

What had to be fixed

  • The first version went into the details of cdm's changes (tests, mutation checks, traps met while writing the code), which regular readers don't need. It now only says that cdm can clean a Mac (prompt 5).
  • The first version said macOS empties both temp folders at every startup, without a source. Looking for one, Claude found that Apple documents only the daily cleanup of files unused for 3 days; the post now cites Chromium's source for the startup cleanup and says which part Claude measured on the Mac (prompt 5).