MacOS – bash script to verify that brew cask is installed

bashhomebrewmacosterminal

I am writing a script to setup a mac development environment, however I am running into an issue on some peoples macs where cask does not install. Is there a way I can verify if cask has been installed in bash?

Ideally I am looking for something like:

if caskIsInstalled then
     # do stuff...
fi

Best Answer

I ended up asking this on stackoverflow, where I was able to come up with this.

if ! brew info cask &>/dev/null; then
  echo "Failed to install Cask (Homebrew Extension)"
  exit 1
fi