What is /private/var/vm on Mac? Can you delete it?
Do not delete anything in /private/var/vm by hand. It holds the swap files macOS uses when memory is full and the sleep image used for safe sleep. Restarting your Mac clears the swap files.
Where it is
/private/var/vmWhat it is
/private/var/vm is the system's virtual memory folder. When apps need more memory than your Mac has, macOS moves data that is not being used to swap files here, named swapfile0, swapfile1 and so on. The more memory pressure, the more swap files appear.
The same folder can hold sleepimage, the file macOS writes the contents of memory to so the Mac can recover if power is lost during sleep.
Both are created, sized and removed by macOS. Swap grows when many apps or browser tabs are open, or when one app uses a lot of memory, and it shrinks again after those apps quit or the Mac restarts.
How big it gets
From almost nothing to many GB, depending on how much memory your apps are using right now.
How to shrink it the right way
- Run the command below to see the files and their sizes. It only lists them.
- Open Activity Monitor and look at the Memory tab. Quit apps that are using far more memory than you expect.
- Restart your Mac. macOS starts again with no swap in use, and the swap files are removed.
- If swap is always large, your Mac is short of memory for what you run on it. Closing browser tabs and background apps helps more than any cleanup.
ls -lh /private/var/vmWhat happens afterwards
After a restart the swap files are gone, and macOS creates new ones only when memory fills up again. The sleep image is recreated when macOS needs it.
How Diskzy handles it
Diskzy shows swap and the sleep image as a named part of System Data, marked "Managed by macOS". It does not offer to delete them.
Related guides
- swapfile/private/var/vm/swapfile0
- sleepimage/private/var/vm/sleepimage
- /private/var/folders/private/var/folders
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