Skip to content

Instantly share code, notes, and snippets.

@hideout
Created June 4, 2016 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hideout/12e3e96d0f081478ff8758e99bc9999c to your computer and use it in GitHub Desktop.
Save hideout/12e3e96d0f081478ff8758e99bc9999c to your computer and use it in GitHub Desktop.
Script upgrading outdated brew casks
#!/usr/bin/env bash
(set -x; brew update;)
(set -x; brew cask update;)
(set -x; brew cleanup;)
(set -x; brew cask cleanup;)
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
casks=( $(brew cask list) )
for cask in ${casks[@]}
do
installed="$(brew cask info $cask | grep 'Not installed')"
if [[ $installed = *[!\ ]* ]]; then
echo "${red}${cask}${reset} requires ${red}update${reset}."
(set -x; brew cask uninstall $cask --force;)
(set -x; brew cask install $cask --force;)
else
echo "${red}${cask}${reset} is ${green}up-to-date${reset}."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment