Skip to content

Instantly share code, notes, and snippets.

Last active April 15, 2020 15:30
What would you like to do?
brew cask upgrade
for c in $(brew cask list); do
info=$(brew cask info $c)
installed_ver=$(echo "$info" | cut -d$'\n' -f1 | tr -d ' ' | cut -d':' -f 2)
current_ver=$(echo "$info" | cut -d$'\n' -f3 | cut -d' ' -f 1 | rev | cut -d'/' -f 1 | rev)
if [ "$installed_ver" != "$current_ver" ]; then
echo "$c is installed '$installed_ver', current is '$current_ver'"
brew cask reinstall $c
Copy link

awade commented Feb 24, 2017

Maybe consider adding the line "brew cask cleanup" to purge the cached downloads. Even add it after as well to free up space. This would avoid the sometimes error of brew reinstalling the wrong version in its downloads folder instead of the fresh version.

Copy link

awade commented Feb 24, 2017

Also, should include a brew update, otherwise it won't actually be working off the latest updated version numbers.

Copy link

qd3v commented Jun 6, 2017

Any downside of this solution? :

brew cask reinstall `brew cask outdated`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment