Glam Prestige Journal

Bright entertainment trends with youth appeal.

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 gimp

But 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
fi

It 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

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy