A Brewfile can define the Homebrew packages that belong on a workstation, project image, or CI runner. Cleaning against that file removes packages that were installed locally but are no longer part of the intended package set.
Homebrew Bundle reads the Brewfile in the current directory unless --file or --global points it somewhere else. The cleanup command is a review step by default and lists what would be removed while returning a nonzero exit code when removals are pending.
Actual removal starts only when --force is added. Review the listed formulae, casks, taps, and other supported dependency types before forcing cleanup, especially on a workstation where some software may be intentionally outside the Brewfile.
brew "hello"
Use --file for a project or task-specific Brewfile. Use --global only when enforcing the configured global Brewfile.
$ brew list --formula hello tree
$ brew bundle cleanup --file Brewfile Would uninstall formulae: tree Run `brew bundle cleanup --force` to make these changes.
Do not add --force until every listed item is safe to remove. Add options such as --no-cask or --no-tap when those package classes are managed outside this Brewfile.
$ brew bundle cleanup --force --file Brewfile Uninstalling tree... (9 files, 303.5KB) Uninstalled 1 formula
--zap makes cask cleanup remove extra application support files. Use it only when those per-app settings and caches should also be deleted.
$ brew list --formula hello
$ brew bundle check --file Brewfile The Brewfile's dependencies are satisfied.
A satisfied check confirms that the remaining Homebrew state still matches the Brewfile.
Related: How to check a Brewfile with Homebrew Bundle