How do I install a specific version of a formula in homebrew? For example, postgresql-8.4.4 instead of the latest 9.0.
As of my knowledge cutoff in January 2022, Homebrew primarily supports installing the latest versions of formulas. However, if you specifically need an older version of a formula, you can use the brew tap command to tap into a repository that contains the historical versions.
brew tap
Here are the steps:
Homebrew provides a “homebrew-versions” repository where older versions of formulas are kept. Tap this repository using the following command:
brew tap homebrew/homebrew-versions
This will add the “homebrew/versions” tap to your Homebrew.
After tapping the repository, you can use the brew install command to install the specific version of the formula you need. For example:
brew install
brew install postgresql@8.4
This installs PostgreSQL version 8.4. Keep in mind that the formula name might slightly differ for some packages.
After installation, you may need to link the formula to make it usable. Follow any instructions provided by Homebrew after the installation command. For example:
brew link postgresql@8.4 --force
The --force flag might be required if there are conflicts with other installed versions.
--force
Please note that the availability of older versions depends on whether they are maintained in the “homebrew-versions” tap. If the tap doesn’t have the version you need, you might need to explore other options such as compiling from source or using version managers like asdf or pyenv, which can handle multiple versions of various tools.
asdf
pyenv
Keep in mind that Homebrew and its ecosystem may have evolved since my last training data in January 2022, so it’s always a good idea to check the latest Homebrew documentation or community discussions for the most up-to-date information.