Skip to main content
1 of 3
Kusalananda
  • 355.9k
  • 42
  • 735
  • 1.1k

One way to get the swap usage on macOS is through sysctl,

$ sysctl vm.swapusage
vm.swapusage: total = 2048.00M  used = 339.25M  free = 1708.75M  (encrypted)

or to get the virtual memory statistics, use vm_stat,

$ vm_stat
Mach Virtual Memory Statistics: (page size of 4096 bytes)
Pages free:                               22689.
Pages active:                           1293975.
Pages inactive:                         1210689.
Pages speculative:                        90024.
Pages throttled:                              0.
Pages wired down:                       1149514.
Pages purgeable:                          45249.
"Translation faults":                 627071029.
Pages copy-on-write:                   17768756.
Pages zero filled:                    444351056.
Pages reactivated:                     10794611.
Pages purged:                            764381.
File-backed pages:                      1352224.
Anonymous pages:                        1242464.
Pages stored in compressor:             1408501.
Pages occupied by compressor:            427131.
Decompressions:                         6806364.
Compressions:                          10983871.
Pageins:                              102270242.
Pageouts:                               7852274.
Swapins:                                1883954.
Swapouts:                               2043277.

It is generally not advisable to disable swap on macOS, and there's usually no need to manually increase the swap file's size.

This question/answer at the Ask Different site talks about moving the swap file to another disk, but the question is over eight years old, so it may be out of date.

Kusalananda
  • 355.9k
  • 42
  • 735
  • 1.1k