Skip to content

Instantly share code, notes, and snippets.

@johnypony3
Last active May 7, 2017 13:59
Show Gist options
  • Save johnypony3/d85bc0d7fbd261f6cc06681be4194f66 to your computer and use it in GitHub Desktop.
Save johnypony3/d85bc0d7fbd261f6cc06681be4194f66 to your computer and use it in GitHub Desktop.
cleanup, update, upgrade bundle, update all casks
#!/bin/bash
brew cleanup
brew cask cleanup
brew update
brew upgrade
#brew bundle
for c in $(brew cask list); do
info=$(brew cask info $c)
installed_info=$(brew cask ls --versions $c)
stringarray=($installed_info)
installed_ver=${stringarray[1]}
stringarray=($info)
latest_ver=${stringarray[1]}
echo "$c is installed, version is '$installed_ver', repo version is '$latest_ver'"
if [ "$installed_ver" != "$latest_ver" ] || [ "$installed_ver" == "latest" ] || [ "$latest_ver" == "latest" ];
then
echo "updating $c to version: '$latest_ver'"
brew cask reinstall $c --require-sha
fi
done
brew cleanup
brew cask cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment