Check brew and brew-cask for valid package names
To get a list of invalid brew formulas:

#!/usr/bin/env bash
for formula in ${brews[@]}; do
    brew info ${formula} &gt;/dev/null 2&gt;&amp;1 || echo ${formula}
done


To get a list of invalid casks:

#!/usr/bin/env bash
for cask in ${casks[@]}; do
    brew cask info ${cask} &gt;/dev/null 2&gt;&amp;1 || echo ${cask}
done


(brews and casks are the arrays defined in your setup script.)