0

When looking at the Activity Monitor it says that I am using 459.5MB of swap.

I would like to figure this number out from the command line.

I have been able to duplicate all the other memory numbers presented by the Activity Monitor using vm_stat, but now I want swap usage as well.

Help?

Activity Monitor, swap file usage 459.5MB

4
  • Is the "private MemRegions" shown by top the swap ? the value is the same on my Mac.. – anki Aug 25 '20 at 10:07
  • Nope. I have 136M private according to top, and 459,5MB swap usage according to the Activity Monitor. – Johan Walles Aug 25 '20 at 10:21
  • What do you see for swapins/swapouts in vm_stat? I've double checked top and vm_stat and like @anki both agree with what's in Activity Monitor. Have you tried killing Activity Monitor and restarting it? – Allan Aug 25 '20 at 12:32
  • For context, I asked because I wanted to ptop (github.com/walles/px) and bubblemon (walles.github.io/bubblemon) output to match the Activity monitor. And thanks to @jksoegaard now they do! – Johan Walles Nov 27 '20 at 13:10
3

You can get the current swap usage on the command line by running the following command:

sysctl vm.swapusage

It will output something similar to:

vm.swapusage: total = 4096.00M  used = 2743.50M  free = 1352.50M  (encrypted)

The number in "used" should correspond with the number you've circled in Activity Monitor.

3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .