Runs in your terminal
Color and progress lines show only in a terminal. A pipe gets plain text, and
Swab respects NO_COLOR.
the
deck.
Swab is an open source command and menu bar app 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
Swab respects NO_COLOR.
Swab.app shows the same numbers as swab status, with a chart of the
last minute. Clean up or free memory with a click. This one works. Try it.
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
The command and the app are in one repository, 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~/.nvm
swab clean prints a table with the sizes and asks once. What it deletes
does not go to the Trash.
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.
No. Swab deletes the files and does not move them to the Trash. The default
categories hold files that apps and tools rebuild, and
swab clean --dry-run lists them without deleting any.
It depends on the Mac. swab clean --dry-run measures yours and deletes
nothing. The dry run at the top of this page is real output, recorded on a build
machine, and it found 403 MB.
node_modules?
No. Swab does not uninstall apps, and it does not look inside your projects. It
cleans the folders of its catalog, such as the npm cache in your home folder, and
leaves the node_modules of a project alone.
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 unused. An app with unsaved changes asks you to save, and stays open until you answer. The last-window rule counts windows, and macOS asks you to allow that under Privacy & Security, Accessibility.
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.