Skip to content

Instantly share code, notes, and snippets.

@abbott
Forked from anildigital/cleanup_swap.md
Created December 10, 2023 23:35
Show Gist options
  • Save abbott/861672a989b6945cee209546655a48ff to your computer and use it in GitHub Desktop.
Save abbott/861672a989b6945cee209546655a48ff 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