GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Wiki
nigel.stanger
/
Wiki
Compare Revisions
View Page
Back to Page History
Homebrew.md
## 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](https://github.com/orgs/Homebrew/discussions/339#discussioncomment-350814) should hopefully work. Otherwise, you have to create a local tap for the older package version and install that. [These instructions](https://blog.sandipb.net/2021/09/02/installing-a-specific-version-of-a-homebrew-formula/) seem to be reasonably up to date. 1. Find the package formula in the `homebrew-core` tap: ```sh brew tap-info homebrew/core cd <homebrew prefix>/Homebrew/Library/Taps/homebrew/homebrew-core/Formula ``` 1. If you don’t already know which version you want, look in the commit log for the package formula: ```sh git log <package>.rb ``` 1. Create new local tap and extract the package version to it: ```sh 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`). 1. Install as usual using the new tap (obviously uninstall the currently installed version first): ```sh brew install <package>@<version> ```
## 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. Otherwise, you have to create a local tap for the older package version and install that. [These instructions](https://blog.sandipb.net/2021/09/02/installing-a-specific-version-of-a-homebrew-formula/) seem to be reasonably up to date. 1. Find the package formula in the `homebrew-core` tap: ```sh brew tap-info homebrew/core cd <homebrew prefix>/Homebrew/Library/Taps/homebrew/homebrew-core/Formula ``` 1. If you don’t already know which version you want, look in the commit log for the package formula: ```sh git log <package>.rb ``` 1. Create new local tap and extract the package version to it: ```sh 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`). 1. Install as usual using the new tap (obviously uninstall the currently installed version first): ```sh brew install <package>@<version> ```