Glossary/Memory

Swap Used

Quick answer

Swap Used is the amount of space on the startup disk that macOS is using to move memory out of RAM and back again. It is used when there is not enough physical memory for everything that is running.

When RAM is full, even after compression, macOS writes some memory to the startup disk and reads it back when it is needed. That disk space is swap.

Even on a fast SSD, reading from disk is much slower than reading from RAM, so heavy swapping makes the Mac feel slow.

Is some swap normal?

Yes. A small amount of swap, especially after the Mac has been on for a long time, is not a problem. macOS may leave old data in swap that is rarely needed. What matters is whether the Mac is actively swapping now, which shows up as yellow or red memory pressure.

How to bring swap down

Quit apps you are not using and close browser tabs. Swap does not always drop right away after apps quit. Restarting the Mac clears it.

If swap climbs quickly every time you use your normal set of apps and memory pressure is often red, the Mac needs more RAM for that workload. Do not delete swap files by hand; macOS manages them.

How to check swap usage on Mac

Swap Used is at the bottom of Activity Monitor's Memory tab. You can also check it in Terminal. These commands only read information.

  1. Run sysctl vm.swapusage. The output shows total, used and free swap. The word encrypted at the end means the swap files are encrypted.
  2. Run ls -lh /System/Volumes/VM to see the swap files themselves, named swapfile0, swapfile1 and so on. Look only. Do not delete or move them.
  3. Watch whether the used figure keeps rising while you work, or stays the same.

How to tell if your Mac is swapping right now

Swap Used is a total. It can stay high long after the Mac stopped swapping. Activity Monitor describes it as compressed data temporarily moved to disk to make room for more recently used data, so data that has not been needed since can simply sit there. To see whether swapping is happening now, look at the rate instead.

  1. Run vm_stat 5 in Terminal. It prints a line every 5 seconds. Press Control-C to stop.
  2. Ignore the first line, which shows totals since startup.
  3. Read the swapins and swapouts columns on the lines that follow. They show how many pages moved between RAM and disk in each 5 second interval.
  4. Zeros most of the time mean the swap on disk is old data and is not slowing you down. Numbers on most lines while you work mean the Mac is actively swapping, and you will usually see yellow or red memory pressure too.

Common causes of high swap

Swap grows when apps need more memory than the Mac can provide by compressing data in RAM. You do not have to be using every app for this to happen. Apps in the background still hold memory. Typical causes:

  • Running more memory heavy apps at once than the Mac has RAM for.
  • Virtual machines, which hold a large amount of memory while they run.
  • An app with a memory leak that grew for hours or days.
  • Many browser tabs left open, each holding memory in the background.
  • Long uptime, where old data was moved to disk earlier and is still there.

Normal vs worrying swap

Normal: some swap after the Mac has been on for days, with memory pressure green and vm_stat showing little or no swap activity. Swap can stay in use even when RAM looks free, because macOS does not read old data back into memory until something asks for it.

Worrying: Swap Used climbs every time you use your normal set of apps, swap activity shows up on most vm_stat lines, and memory pressure is yellow or red. The Mac needs more RAM for that workload, or fewer apps running at the same time. Vitals keeps 30 days of memory history per app, which can show which app was growing before swap went up.

Questions people ask

What is Swap Used on Mac?

It is the space on your startup disk that macOS is using as extra memory when RAM is full.

Is high swap bad for my Mac?

A small amount is normal. Large or growing swap, along with yellow or red memory pressure, means the Mac is short on RAM and will be slower.

How do I clear swap on Mac?

Quit memory heavy apps, or restart the Mac. Do not delete swap files manually.

Does swap wear out my Mac's SSD?

Swap writes to the SSD, and every SSD can handle a limited amount of writing over its life. Occasional swap is not a concern. Constant heavy swapping writes more, so it is worth reducing for speed and wear.

Where are swap files stored on Mac?

In `/System/Volumes/VM`, as files named swapfile0, swapfile1 and so on. macOS creates and removes them as needed, and they should not be touched.

Can I turn off swap on Mac?

There is no setting for it, and you should not try. Without swap, apps would run out of memory instead of slowing down.

Related

Looking for something better than Activity Monitor? See the best Activity Monitor alternatives for Mac, or browse every term in the glossary.