Skip to content

Instantly share code, notes, and snippets.

@eirc
Created December 27, 2018 13:37
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 eirc/8b1c5b2e25515b2da234ac2c4bab39bb to your computer and use it in GitHub Desktop.
Save eirc/8b1c5b2e25515b2da234ac2c4bab39bb to your computer and use it in GitHub Desktop.

Old versions of brew packages

Easy mode

Downgrading a brew package can sometimes be super easy with:

brew switch <package> <version>

But that's only possible if you have previously installed that version and haven't run brew cleanup every since. If that's not the case you'll get an error like:

Error: <package> does not have a version "<version>" in the Cellar.

Hard mode

If the Easy mode does not help you:

  1. Go to formulas folder

    /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula

  2. Check git history of the package you wanna downgrade

    git log -- <package>.rb

  3. Checkout a version where package was in needed version

    git checkout <commit>

  4. Install package skipping brew's auto update

    HOMEBREW_NO_AUTO_UPDATE=1 brew install <package>

  5. Pin package to avoid future updates

    brew pin <package>

  6. Checkout master again in formulas to allow brew to work properly

    brew checkount master

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