Is there any way to upgrade brew cask

Is there any way to upgrade all brew casks? Something like brew cask upgrade?


As of December, 2017, brew cask upgrade is a thing.

https://github.com/Homebrew/brew/pull/3396


Bash script to upgrade packages

inspired by Pascal answer

#!/usr/bin/env bash

(set -x; brew 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
    version=$(brew cask info $cask | sed -n "s/$cask:\ \(.*\)/\1/p")
    installed=$(find "/usr/local/Caskroom/$cask" -type d -maxdepth 1 -maxdepth 1 -name "$version")

    if [[ -z $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

What it does

  • update brew/brew cask, cleanup
  • read the casks list
  • check the brew cask info for the newest version
  • install new version if available (and removes all old versions!)

source: https://gist.github.com/atais/9c72e469b1cbec35c7c430ce03de2a6b

one liner for impatient:

curl -s https://gist.githubusercontent.com/atais/9c72e469b1cbec35c7c430ce03de2a6b/raw/36808a0544628398f26b48f7a3c7b309872ca2c6/cask_upgrade.sh | bash /dev/stdin

save as /usr/local/bin/cask-upgrade, so you can run it locally as cask-upgrade later