Skip to content

Instantly share code, notes, and snippets.

@talarczykco
Last active March 13, 2023 12:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talarczykco/05a741598a3c57afd73d56ae15e97a62 to your computer and use it in GitHub Desktop.
Save talarczykco/05a741598a3c57afd73d56ae15e97a62 to your computer and use it in GitHub Desktop.
How to install old versions of Homebrew formulas and switch between them

This example uses istioctl as the formula, but this may come in handy for kubernetes-cli, kubernetes-helm, etc.

  1. Find the formula for your executable, e.g. istioctl, and click on the link to GitHub:
    brew info istioctl | grep Formula
    
  2. Click "Blame" button ("History" will be too large to display).
  3. Hopefully, you can find an earlier versioned commit message... click on it.
  4. Click ... in upper-right of next page, select "View File" from drop-down.
  5. Right-click "Raw" button, and Copy URL Address.
  6. Paste URL into install command, which will look something like:
    brew install https://github.com/Homebrew/homebrew-core/raw/af5f8075d6c64e555812ce818e1d52fe0613b030/Formula/istioctl.rb
    
  7. If all goes well, you should be able to switch between versions. Use this command fragment to find available versions:
    brew switch istioctl
    
  8. Use complete command to relink and switch to using that version:
    brew switch istioctl 1.0.5
    
@msarmadi
Copy link

Found this alternative which is more compatible with my brew version(recent):
https://cmichel.io/how-to-install-an-old-package-version-with-brew/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment