Skip to content

Instantly share code, notes, and snippets.

@pythoninthegrass
Forked from anildigital/cleanup_swap.md
Last active June 26, 2023 17:06
Show Gist options
  • Select an option

  • Save pythoninthegrass/52a4642fc31a7e110fe1145608b0e3df to your computer and use it in GitHub Desktop.

Select an option

Save pythoninthegrass/52a4642fc31a7e110fe1145608b0e3df 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
@pythoninthegrass
Copy link
Author

pythoninthegrass commented Jun 26, 2023

Comment out lines to be skipped. Could refactor into mini functions w/,main, but why tho ¯\_(ツ)_/¯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment