Mac sleepimage and swap files: why /private/var/vm can hold gigabytes, and what actually shrinks it
Your Mac keeps two kinds of memory files on disk: a sleepimage (a copy of RAM for safe sleep) and swap files (memory pages that did not fit in RAM). Both live on a small hidden volume, both are managed by macOS, and both can add up to a surprising number on a 256 GB Mac.
Good news first: you rarely need to delete anything. Swap goes away on its own once memory pressure drops, and the sleepimage is there for a reason.
Where they live
- The folder you'll see in guides is
/private/var/vm. - On macOS Catalina and later it points to its own APFS volume, mounted at
/System/Volumes/VM. - Inside:
sleepimageandswapfile0,swapfile1and so on. - Because it's a separate volume in the same container, its space comes out of the same free space as your files, and Storage settings counts it under System Data.
Step 1: look, don't touch
Example of what sysctl prints on a busy Mac (yours will differ):
- total is what the swap files take on disk now: 6144 MB = 6 GB here.
- used is how much of that holds memory pages: 5321 MB, about 87% of it.
- Activity Monitor > Memory shows the same figure as Swap Used, next to the Memory Pressure graph.
The sleepimage: what hibernatemode means
| hibernatemode | What happens at sleep | Default on | sleepimage written? |
|---|---|---|---|
| 0 | RAM stays powered, nothing copied to disk | Desktops (iMac, Mac mini, Mac Studio, Mac Pro) | No |
| 3 | Safe sleep: RAM copied to disk and kept powered; if the battery runs out, the Mac restores from disk | Laptops (MacBook Air, MacBook Pro) | Yes |
| 25 | Hibernate: RAM copied to disk and power removed; slower sleep and wake, less battery drain | Never default, set with pmset | Yes |
On Intel Macs the sleepimage is usually the size of installed RAM. On Apple silicon it's often smaller, because only what's needed is saved. Check yours with ls -lh /System/Volumes/VM/sleepimage.
How much of your disk that is
Worst case is a laptop in mode 3 with a RAM-sized sleepimage plus a few GB of swap. Here is the share of the disk, with 4 GB of swap added:
| RAM | sleepimage (RAM-sized) | + 4 GB swap | Share of 256 GB | Share of 512 GB |
|---|---|---|---|---|
| 8 GB | 8 GB | 12 GB | 4.7% | 2.3% |
| 16 GB | 16 GB | 20 GB | 7.8% | 3.9% |
| 32 GB | 32 GB | 36 GB | 14.1% | 7.0% |
| 64 GB | 64 GB | 68 GB | 26.6% | 13.3% |
Share = (sleepimage + swap) / disk size, so 20 / 256 = 7.8%. On a desktop in mode 0 the sleepimage column is zero and only swap is left.
Shrinking swap: lower the memory pressure
- Open Activity Monitor > Memory and sort by Memory.
- Quit what you're not using: browser windows with dozens of tabs, VMs, Docker, Simulators, big Photoshop files.
- Watch Memory Pressure. Green means RAM is coping; yellow or red means macOS is leaning on swap.
- Restart. Swap files are removed at boot and only come back if pressure does.
- Run
sysctl vm.swapusageagain. If total climbs back to many GB every day, the fix is fewer apps open at once (or more RAM next time), not cleanup.
Never delete swapfile entries yourself. They hold live memory of running apps; removing them can crash those apps or the whole system.
The sleepimage: usually leave it
- On a laptop, mode 3 protects your open work if the battery dies during sleep. That's worth a few GB.
- On a desktop it's normally already mode 0, so there's nothing to win.
- Guides that run
sudo pmset -a hibernatemode 0and then delete the file do get the space back on a laptop, but you lose that protection. If you do it anyway, keep the battery topped up and undo it withsudo pmset -a hibernatemode 3. - A sleepimage that's far bigger than your RAM, or a VM volume that never shrinks after a restart, is worth asking Apple Support about rather than deleting.
Where the space usually is instead
If System Data is huge and the VM volume is only a few GB, look at local snapshots and purgeable space first: purgeable space and Time Machine snapshots, measured. Developers should also check Xcode and iOS Simulators, and anyone can check the Spotlight index.
Zofle shows where your Mac's space went, category by category, so you can tell whether swap is the problem or just a few GB next to caches and old downloads.
Download Zofle for MacSources and method
- pmset command reference: hibernatemode 0 (default on desktops), 3 (safe sleep, default on laptops), 25 (hibernate); hibernatefile location.
- Apple Activity Monitor User Guide, View memory usage (Memory Pressure, Swap Used).
- Apple Mac User Guide, Free up storage space on your Mac. Sources checked 10 November 2026.
- The disk-share table is arithmetic for a RAM-sized sleepimage plus 4 GB of swap, decimal GB. The sysctl line is an example of the output format, not a reading from your Mac.
Zofle Pro news
People signing up now will get Zofle Pro, with more features, for free when we launch it.