Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Homebrew: list available versions with new formula@version format

Tags:

homebrew

People also ask

How do I install a specific version of a package with brew?

Installing the latest package: Easy Installing with brew can't be made any simpler. Search the package you need, type brew install <package-name> , and that's all.

What does brew list do?

brew provides commands for getting common types of information out of the system. brew list shows installed formulae. brew deps foo shows the dependencies that foo needs. Additional commands, including external commands, can of course be written to provide more detailed information.

How do I find my Mac brew version?

If you want to know what version of brew (homebrew) is installed on your device (macOS or any Linux/Unix OS) you can do so by using the brew --version command on the Terminal application. The Homebrew version will be displayed along with the git revision and the last commit date details.


You can search versions using brew search.

For example:

$ brew search postgresql
postgresql ✔      [email protected]     [email protected]

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.

Note: This method will only work with Formulae and not Casks.


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.