Page History

Homebrew

Nigel Stanger edited this page on 3 Jul 2023

Clone this wiki locally

Downgrading to an older version of a package

If the older version happens to still be locally available (true until Homebrew does one of its periodic cleanups), it will appear in brew info <package> and you can just brew install the locally available version directly. Homebrew can only install versioned packages that have explicit versioned formulas, i.e., package@version. There used to be a brew switch command that let you switch versions but Homebrew removed that around version 2.6 (see https://github.com/orgs/Homebrew/discussions/339 for reasons). If the old version of the package is still installed as noted above, then these commands should hopefully work.

Otherwise, you have to create a local tap for the older package version and install that. These instructions seem to be reasonably up to date.

  1. Find the package formula in the homebrew-core tap:

    brew tap-info homebrew/core
    cd <homebrew prefix>/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
  2. If you don’t already know which version you want, look in the commit log for the package formula:

    git log <package>.rb
  3. Create new local tap and extract the package version to it:

    brew tap-new $USER/local-<package>
    brew extract --version=<version> <package> $USER/local-<package>

    Watch out for weird dependency issues—you might need to edit the extracted <package>@<version>.rb (which should be in /usr/local/Homebrew/Library/Taps/$USER/local-<package>/Formula).

  4. Install as usual using the new tap (obviously uninstall the currently installed version first):

    brew install <package>@<version>