The sleepimage stores a copy of memory so a Mac can recover after power loss during sleep. Swapfiles hold memory overflow when apps need more RAM than the Mac has. macOS creates, resizes and removes both. Deleting them by hand can fail or cause trouble, so the verdict is Keep. Quit big apps and restart to shrink swap.
- Path
/private/var/vm/sleepimageand/private/var/vm/swapfile*- What it is
- System files for saving memory during sleep and for memory overflow (swap)
- Typical size
- The sleepimage can be as large as your Mac's memory; swap grows and shrinks with memory pressure
- Made by
- macOS
- Safe to delete?
- Keep macOS manages them. Do not delete by hand.
- Comes back?
- Yes. macOS recreates them as needed.
What are sleepimage and swapfiles?
The sleepimage is written when the Mac goes into a deeper sleep mode so that your session can be restored if the battery runs out. Swapfiles, named swapfile0, swapfile1 and so on, give the Mac extra working room when memory is full. The system keeps them in /private/var/vm, inside protected system storage.
You can look at them with a read-only command.
ls -lh /private/var/vm
Is it safe to delete the sleepimage or swapfiles?
No. They are managed by macOS, and the folder is protected. Removing them by hand is unsupported, can be blocked by system protections, and if it works can cause crashes or lost state for running apps. Do not use sudo rm on system paths. Apple does not document a way to turn this into free space by deleting the files.
How do I make them smaller?
- Save your work and quit memory-heavy apps such as video editors, virtual machines and many browser tabs.
- Restart the Mac. Swap files are cleared at restart.
- If swap keeps growing, open Activity Monitor and the Memory tab to see which app is using the most, and close or fix that app.
A Mac that swaps all the time is short on memory. The long-term fix is using fewer heavy apps at once, not deleting the swapfiles.
How Clean House handles it
Clean House shows the swap area as memory overflow made by macOS, with the call Keep, and says that it shrinks when you quit large apps or restart. System files are never offered for cleaning.