Backup

brew tap Homebrew/bundle
brew bundle dump --file=Brewfile

Restore

brew tap Homebrew/bundle
brew bundle install --file=Brewfile