Reverting Heroku CLI to v8 using Homebrew
Over time, I've built up a variety of elaborate python, bash and other scripts, so it's deeply annoying when a tech provider makes major breaking changes to their API or CLI without advanced notice...
Heroku recently released CLI v9, which breaks all sorts of command syntax and outputs data in different formats and structures. It is a travesty. Our systems updated and things went haywire right away. Looking at hours and hours of work to fix something that should never have broken, we decided version reversion might be the best path forward to resolve the issues with a variety of handler scripts and functions.
Unfortunately, reverting Heroku CLI versions is easier said than done when you installed a package like Heroku CLI on a MacOS system via Homebrew (brew.sh) initially. It's quite a bit easier on Ubuntu, where you can just use npm. Trying this approach on a mac is an exercise in frustration as well, so I came up with a better solution and wanted to share it with the internet in case anyone else feels similar frustration in the future.
if you have a mac that updated to Heroku CLI v9 (or any version with breaking changes), you can revert it to the terminal version 8 with this command:
brew uninstall Heroku && wget
https://raw.githubusercontent.com/heroku/homebrew-brew/3b6ca6a88b49e47a0fd7625eff10a2475ac7e1a4/Formula/heroku.rb
&& brew install heroku.rb
Homebrew (the package manager) blocks insecurely linking brew digests, which is why we need to download the file locally to re-install it.
The structure of this file is https://raw.githubusercontent.com/heroku/homebrew-brew/COMMITHASH/Formula/heroku.rb, in case you need another version in the future.
Last updated