Homebrew – Install All Packages from Text File

homebrew

Does Homebrew offer anything similar to pip's pip install -r requirements.txt feature? I have a new MacBook Pro arriving today, so one of the first tasks will be to migrate my brew installations. I've already performed a brew list > brew.txt command. Will I be able to use this to install all the packages it lists in one command on the new machine?

Best Answer

You can do brew leaves > my_brews.txt and then on the new machine do for i in $(cat brew_leaves); do; brew install "$i"; done. You can use newlines where there are semicolons above. [assuming bash]