brew uninstall --zap: removing the files a Homebrew app leaves in your Library, and the catch
Uninstalling a Homebrew cask removes the app but leaves its settings and caches. The zap option removes those too, sometimes more than you meant.
brew uninstall --cask some-app removes the app from Applications. It does not touch what the app created in your Library: caches, preferences, application support data, logs. That is the same gap as dragging an app to the Trash. Homebrew has an option that closes it.
What zap does
Many casks include a list of the files and folders the app creates, written by whoever maintains that cask. --zap removes them along with the app.
brew uninstall --zap --cask some-appSee the list before you run it
brew cat --cask some-app | sed -n '/zap/,/^ end/p'That prints the cask's zap section: the paths it will move to the Trash or delete. Read it. Some casks list folders shared by every app from the same company.
Apps you already uninstalled
Zap only works on an installed cask. For an app removed months ago, read its zap list with brew cat (it works without installing) and remove what you find by hand, moving to the Trash so you can undo it.
brew cat --cask some-app | grep -E '~/Library|/Library' | tr -d '",' The rest of Homebrew's leftovers
brew autoremove # dependencies nothing needs any more
brew cleanup --prune=all # old versions and the download cacheOur guides to Homebrew's cache and Homebrew packages cover both in more depth.
Common questions
What does brew uninstall --zap do?
It removes a Homebrew cask's app and the files the cask lists in its zap section, typically caches, preferences and application support data in your Library.
Is brew zap safe?
Mostly, but read the list first with brew cat --cask followed by the name. Homebrew warns zap may remove files shared with other apps from the same developer.
Can I zap an app I already uninstalled?
Not directly. Read its zap list with brew cat --cask followed by the name, then remove those paths by hand, moving them to the Trash.