How can I install all brew packages listed in a text file?

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]


xargs brew install < brew.txt

No need to cat the file (see Useless Use of Cat Award) and xargs instead of a for loop to avoid IFS.