128

Homebrew recently deprecated homebrew/versions in favour of making versions available on homebrew/core via the new formula@version format. For example (as per this answer), you can do brew install postgresql@9.5.

Of course, this doesn't work for arbitrary versions. For instance, install cocoapods@1.1.1 turns up "Error: No formulae found in taps".

Under the old method, I could run brew versions <formula> to see available versions. How do I list available versions now?

Community
  • 1
  • 1
Phlippie Bosman
  • 3,983
  • 3
  • 21
  • 26

3 Answers3

149

You can search versions using brew search.

For example:

$ brew search postgresql
postgresql ✔      postgresql@9.4     postgresql@9.5
Amelio Vazquez-Reina
  • 74,000
  • 116
  • 321
  • 514
24

This is an old question, but I found a "better" (for me) way to do this:

brew info --json PACKAGE_NAME | jq -r '.[].versioned_formulae[]'

For example, in the case of the package node, this will print:

$ brew info --json node | jq -r '.[].versioned_formulae[]'
node@10
node@12
node@8

You will need the program jq installed for it to drill down into the appropriate JSON, (brew install jq).

Since the above is gnarly to write/remember, I suggest setting up an alias or function in your favorite shell.

Jrop
  • 3,932
  • 4
  • 25
  • 40
19

And in case you wanted to just look up the specific version used by a formula after finding it using search, you can get the info with:

brew info <formula>
# or for a cask:
brew cask info <formula>

e.g. brew info postgresql@10, or brew cask info vlc

And if you can't find a popular old version of a cask, you may be able to get it via homebrew-cask-versions, which is installable with brew tap homebrew/cask-versions.

qix
  • 6,008
  • 1
  • 44
  • 58