Created
May 16, 2017 01:17
-
-
Save kane-c/5abd49709e49b7b92eaaf693ac109ca9 to your computer and use it in GitHub Desktop.
Upgrade Brew and all installed packages including casks, then clean up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew-upgrade() { | |
(set -x; brew update;) | |
red=`tput setaf 1` | |
green=`tput setaf 2` | |
reset=`tput sgr0` | |
casks=( $(brew cask outdated) ) | |
for cask in ${casks[@]} | |
do | |
version=$(brew cask info $cask | sed -n "s/$cask:\ \(.*\)/\1/p") | |
echo "${red}${cask}${reset} requires ${red}update${reset}." | |
(set -x; brew cask uninstall $cask --force;) | |
(set -x; brew cask install $cask --force;) | |
done | |
brew upgrade | |
(set -x; brew cleanup;) | |
(set -x; brew cask cleanup;) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment