Skip to content

Instantly share code, notes, and snippets.

@danijeljw
Last active December 17, 2017 19:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save danijeljw/9f5f400a9f30c7c99090c520cf5aa7e0 to your computer and use it in GitHub Desktop.
Save danijeljw/9f5f400a9f30c7c99090c520cf5aa7e0 to your computer and use it in GitHub Desktop.
Upgrade casks installed via Homebrew Cask
#!/usr/bin/env bash
brew update
brew cask update
casks=( $(brew cask list) )
for cask in ${casks[@]}
do
# in the first line there is version
current="$(brew cask info $cask | sed -n '1p' | sed -n 's/^.*: \(.*\)$/\1/p')"
installed=( $(ls /opt/homebrew-cask/Caskroom/$cask))
if (! [[ " ${installed[@]} " == *" $current "* ]]); then
(set -x; brew cask install $cask --force;)
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment