Workaround for brew cask pin


I'm a big fan of Homebrew, the package manager for MacOS. There's only one problem -- I need to keep one cask (AKA a GUI application) at a specified version because I haven't paid for the latest version.

Homebrew doesn't support pinning casks to a specified version, as it's technically infeasible to do so. See here and here. However, I've devised a workaround using the command line.

brew outdated -g --json | jq '.formulae[].name,.casks[].name' | grep -v app_to_not_upgrade | xargs -n1 brew upgrade

Replace "app_to_not_upgrade" with the name of the cask you want to "pin", and run this command. This command calls brew to list the outdated formulae and casks in json format, extracts the name for each, removes the app to be "pinned", and finally upgrades each app one by one using xargs.