Skip to content

Instantly share code, notes, and snippets.

@hiroshiro
Created January 17, 2017 20:44
Show Gist options
  • Save hiroshiro/6acd01a2bbd768081c94357c6a9a8d7d to your computer and use it in GitHub Desktop.
Save hiroshiro/6acd01a2bbd768081c94357c6a9a8d7d to your computer and use it in GitHub Desktop.
fullBrewUpdate(){
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
brew upgrade
brew cleanup
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment