Skip to content

Instantly share code, notes, and snippets.

@anildigital
Last active April 9, 2024 15:52
Show Gist options
  • Star 32 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save anildigital/f3249a5d5fdbcb93f62d25a06705846f to your computer and use it in GitHub Desktop.
Save anildigital/f3249a5d5fdbcb93f62d25a06705846f to your computer and use it in GitHub Desktop.
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