Per the Bundle github README, Bundler is a [1] “Bundler for non-Ruby dependencies from Homebrew, Homebrew Cask, Mac App Store(MAS) and Whalebrew.”
Brew bundle creates a text file called Brewfile listing all the currently installed applications managed via Brew and the Mac App Store. This Brewfile can be used as a backup and gives you the ability to restore applications when reinstalling macOS or setting up a new environment.
The screenshots below are from the Bundle Brew Documentation page. [2]
The first time the command, brew bundle, is run it will install, if not already.
brew bundle
To create the Brewfile use the command, brew bundle dump, and a text file with all the Brew, Mac App Store apps, and their dependancies will be created in the current directory.
brew bundle dump
The below Brewfile contains all the installed Brew and MAS apps
Using command, brew bundle check, will check to see if all dependancies are installed from the Brewfile. The command, brew bundle list, will list all the dependancies present in a Brewfile.
brew bundle list
brew bundle check
The command, brew bundle install, will use the Brewfile in the current directory and install any application listed, but not currently installed.
In this example the brew cask application atom was added to the dumped Brewfile, and when the install command is run it installed atom.
brew bundle install
Using the command, brew bundle cleanup, will remove any apps installed, but not listed in the Brewfile.
In the below screenshots atom was removed from the Brewfile. When the command, brew bundle cleanup, the output shows what will be uninstalled. To actually uninstall the apps, use the command brew bundle cleanup –force.
brew bundle cleanup
brew bundle cleanup --force