Runs in your terminal
Color and progress lines show only in a terminal. A pipe gets plain text, and
NO_COLOR is respected.
the
deck.
Swab is a command for macOS. It frees disk space and memory, and quits the apps you left open.
A Mac used for development
fills up on its own. Xcode
leaves
DerivedData behind, every package manager
keeps a cache, and the app you
opened on Monday
still holds memory
on Friday.
All of it can go.
Color and progress lines show only in a terminal. A pipe gets plain text, and
NO_COLOR is respected.
Swab.app shows the same numbers as swab status, with a chart of the
last few minutes. Clean up or free memory with a click.
swab clean deletes caches, logs and Docker leftovers that get
rebuilt. swab purge flushes the file cache from memory.
Two rules, both off until you turn them on. Apps quit the way Command-Q quits them. Swab never force quits.
$ swab unused after
Quit an app when its last window closes
$ swab unused last-window on
Every command takes --json. A command that deletes takes
--dry-run, and will not run unattended without --yes.
For macOS 14 or later, on Apple silicon and Intel. The cask installs Swab.app
and the swab command. Or take the disk image and drag Swab to
Applications.
$ brew tap jxnxts/swab https://github.com/jxnxts/swab
$ brew install --cask jxnxts/swab/swab
Written from scratch in Swift, with ideas from Stats, PureMac and MagicQuit. Bug reports and pull requests are welcome.
Read the source on GitHub

Swab deletes what is inside the folders of its catalog and nothing else. It does not follow symbolic links, and it stays out of these.
~/.ssh~/.aws~/.gnupg~/.kube~/.docker~/.claude~/.config~/.nvmswab clean prints a table with the sizes and asks once.
The default categories hold files that tools rebuild or download again. The cost is time: the next Xcode build starts from zero.
The rules are in Safety.swift, and the tests for them in SafetyTests.swift.
Not answered here? Ask in an issue
Two things need root: swab purge, because the purge tool in
macOS does, and the system-queue category, because only root can read
that folder. Nothing else asks.
Swab.app is not notarized by Apple yet, so macOS stops it the first time. Open Swab once, then go to System Settings, Privacy & Security, and choose Open Anyway. You do this once.
Yes. Tap the repository, then run brew install jxnxts/swab/swab, without
--cask. Homebrew builds the command on your Mac, so it needs the Xcode
Command Line Tools, and macOS has nothing to verify.
Usually not. macOS gives the file cache back on its own when an app needs memory. A purge helps right before a job that needs a lot of memory at once.
Swab.app does the quitting, so it has to be running in the menu bar. The app in front never counts as idle. An app with unsaved changes asks you to save, and stays open until you answer.
Finder, and anything that has no Dock icon. Music, Spotify, Podcasts and VLC start out excluded from the last-window rule, because they keep playing with no window open.
No. Swab has no network code. It runs local tools such as docker and
brew, which may use the network themselves.
No. Swab reads macOS and nothing else.