For script and automation usage, I found out that brew bundle --help
is very convenient.
If you do not want to use real bundle file, this snippet works fine in scripts:
brew bundle -v --file=- <<-EOF
brew "mc"
brew "ffmpeg"
brew "wget"
cask "cpuinfo"
cask "intel-power-gadget"
cask "unetbootin"
cask "vlc"
EOF
The good side of it, it will automatically detect if package is not installed, if it is outdated and only then will install it.
If you do not want updates, add a flag --no-upgrade
. I have put -v
for verbosity, as want more details, but you can skip it, or even use -q
for even more silent run.
brew --cellar "$formula" >/dev/null 2>&1
--cellar formula: Display the location in the cellar where formula would be installed, without any sort of versioned directory as the last path.
brew man page; would have loved to give it as an answerif [ ! -x "$(command -v PKG_EXEC)" ]; then # package not installed fi