Skip to content

Instantly share code, notes, and snippets.

@2k0ri
Last active April 7, 2018 07:33
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 2k0ri/aad96a706e38d2468cc5 to your computer and use it in GitHub Desktop.
Save 2k0ri/aad96a706e38d2468cc5 to your computer and use it in GitHub Desktop.
brew caskのappどもをupgradeする ref: https://qiita.com/2k0ri/items/9fe8d33a72dbfb15fe6b
brew-cask-upgrade(){ for app in $(brew cask list); do local latest="$(brew cask info "${app}" | awk 'NR==1{print $2}')"; local versions=($(ls -1 "/usr/local/Caskroom/${app}/.metadata/")); local current=$(echo ${versions} | awk '{print $NF}'); if [[ "${latest}" = "latest" ]]; then echo "[!] ${app}: ${current} == ${latest}"; [[ "$1" = "-f" ]] && brew cask install "${app}" --force; continue; elif [[ "${current}" = "${latest}" ]]; then continue; fi; echo "[+] ${app}: ${current} -> ${latest}"; brew cask uninstall "${app}" --force; brew cask install "${app}"; done; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment