I'd like to check programmatically if a software is installed via Homebrew, then install it only if it is NOT already installed. Here is the command I came up:
brew list gimp >/dev/null 2>&1 || brew install --cask gimpBut it does not seem to work properly. Any idea?
More specifically, I think this is going to work to programmatically install or update GIMP only when it's necessary:
brew list gimp >/dev/null 2>&1 || brew install --cask gimp
if [[ $(brew outdated | grep -c gimp) > 0 ]]; then for f in /Applications/GIMP-*.app; do [[ -e "$f" ]] && rm -rf "$f" done brew reinstall gimp
fiIt seems as if the name of the formula is taken to be gimp >/dev/null instead of gimp?
brew list -q gimp >/dev/null
Found a cask named "gimp" instead. Try brew uninstall --cask gimp
Error: No such keg: /usr/local/Cellar/gimp Reset to default