Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Cleanup swap space on macOS

To see current swap usage

sysctl -a | grep swap

Use only when when your system is in a very bad shape

$ sudo pkill -HUP -u _windowserver 

To monitor, what's creating/updating these swap files, run:

$ sudo fs_usage | grep swapfile

Or for page ins/outs, run:

$ sudo fs_usage | grep PAGE_

To see what WindowServer process is doing exactly, run:

$ sudo spindump -reveal $(pgrep WindowServer)

or for kernel_task, run:

$ sudo spindump -reveal 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment