What are swapfiles on Mac, and can you delete them?
Do not delete swap files. They hold memory that running apps are still using, and removing them can crash those apps or the whole system. Restart your Mac to clear them safely.
Where it is
/private/var/vm/swapfile0What it is
When your apps need more memory than your Mac has, macOS first compresses memory and then moves the least used parts to disk. Those parts go into swap files named swapfile0, swapfile1 and so on. macOS keeps them on a dedicated VM volume, which appears at /private/var/vm.
Swap grows when you run many apps, keep a lot of browser tabs open, or use memory-hungry tools such as virtual machines and local AI models. macOS adds swap files as needed and removes them when memory pressure drops, though not always promptly.
Large swap is a sign that your Mac is short of memory for what you are doing, not a sign that something is wrong with your disk.
How big it gets
From nothing at all to several GB, and tens of GB under heavy memory pressure.
How to shrink it the right way
- Run the command below to see how much swap is in use right now. It only reads the value.
- Open Activity Monitor, choose the Memory tab and sort by Memory to find the apps using the most.
- Quit the ones you do not need. macOS can then release swap by itself.
- Restart your Mac. This clears all swap files and is the reliable way to get the space back.
sysctl vm.swapusageWhat happens afterwards
After a restart, swap starts at zero and grows again only if your apps need more memory than is installed. If it climbs back quickly, the cause is memory use, and the fix is fewer open apps or more RAM.
How Diskzy handles it
Diskzy shows swap under System Data, next to the sleep image, marked "Managed by macOS". It does not offer to delete it.
Related guides
- sleepimage/private/var/vm/sleepimage
- Time Machine local snapshots(APFS snapshots, not a folder)
- Ollama models~/.ollama/models
See where your Mac's space went
Diskzy maps your disk, explains System Data and clears what's safe. Free for 72 hours, then $9 once for 2 Macs.
Try Diskzy for free