2

While brew has an accessible simple versioning mechanism, it's restricted to versions used by a large number of people. So for popular versions, it's easy:

brew search node # gives node@6, node@8, node@10 brew search postgresql #gives [email protected], [email protected], [email protected], postgresql@10 brew search python # gives python@2 

And I can install one for instance with brew install python@2.

But for less popular versions which got removed, let's say [email protected], then it's not obvious how to install them:

$ brew install [email protected]
Error: No available formula with the name "[email protected]"
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.

1 Answer 1

5

Solution based on Versions.html doc

To install a removed brew formula version, we can follow the suggestion from https://docs.brew.sh/Versions.html:

  1. We create an empty repo on our GitHub account: https://github.com/Coeur/homebrew-repo
  2. We add an empty commit to it (git commit --allow-empty -m "first commit"), otherwise brew may not find HEAD.
  3. We extract the old formula with brew extract git Coeur/repo --version=2.20.1
  4. We install this old formula with brew install coeur/repo/[email protected]

(note: uninstall command will be brew uninstall [email protected])
More doc at https://docs.brew.sh/How-to-Create-and-Maintain-a-Tap


Solution based on manual search

  1. Find the repository of the formula with brew info git. It should tell us it's https://github.com/Homebrew/homebrew-core/blob/master/Formula/git.rb
  2. From that page, click the History button on the right to get to https://github.com/Homebrew/homebrew-core/commits/master/Formula/git.rb
  3. Choose a commit diff with your relevant version, for instance https://github.com/Homebrew/homebrew-core/commit/67903b677219559ac72b3fb45932d43426e157f0#diff-3e84bae646d908b93e043833873d316d for 2.20.1
  4. Click View file to get to the full file at this version: https://github.com/Homebrew/homebrew-core/blob/67903b677219559ac72b3fb45932d43426e157f0/Formula/git.rb
  5. Click Raw to get to the raw file at this version: https://raw.githubusercontent.com/Homebrew/homebrew-core/67903b677219559ac72b3fb45932d43426e157f0/Formula/git.rb
  6. We install this formula with brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/67903b677219559ac72b3fb45932d43426e157f0/Formula/git.rb

(note: uninstall command will be brew uninstall git)

1
  • 2
    Hi, this is not working for me as it gives the following error: Error: Non-checksummed download of node%4010 formula file from an arbitrary URL is unsupported! brew extract or brew create and brew tap-new to create a formula file in a tap on GitHub instead. Commented Sep 27, 2022 at 4:30

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.