KennyHan
KennyHan

Reputation: 11

Brew available files for different macOS version

Take install Python for example.

==> Installing opencv dependency: python
==> Downloading https://homebrew.bintray.com/bottles/python-3.6.5.high_sierra.bottle.tar.gz

The brew SW download the one that's matched with my current macOS version as default. (In this case, it's for high_sierra (10.13.x) macOS). But I'd like to get other build version for previous macOS version (e.g. 10.10.x).

I notice that the SW that's all downloaded from https://homebrew.bintray.com/bottles/. But unfortunately, I can't view the available files under the https://homebrew.bintray.com/bottles/ path.

Is there a command to view available files (e.g. Python) for different macOS version ?

Upvotes: 1

Views: 132

Answers (1)

bfontaine
bfontaine

Reputation: 19810

You can use either brew info --json=v1 <formula> or Homebrew’s public JSON API:

$ brew info --json=v1 python | jq .
[
  {
    "name": "python",
    "desc": "Interpreted, interactive, object-oriented programming language",
    "homepage": "https://www.python.org/",
    // ...
    "bottle": {
      "stable": {
        // ...
        "files": {
          "high_sierra": {
            "url": "https://linuxbrew.bintray.com/bottles/python-3.6.5.high_sierra.bottle.1.tar.gz",
            "sha256": "7e0fc1b078b51d9478ab08660d5df01611976a7af0f6c24054bda58264bb506c"
          },
          "sierra": {
            "url": "https://linuxbrew.bintray.com/bottles/python-3.6.5.sierra.bottle.1.tar.gz",
            "sha256": "2fe5ca9be0f1596798927c4aa1d4d187ca7f83adc4681483cec2cc52d7c95386"
          },
          "el_capitan": {
            "url": "https://linuxbrew.bintray.com/bottles/python-3.6.5.el_capitan.bottle.1.tar.gz",
            "sha256": "bccf50de973644608af29652f2660124d033f3213d422fe44a7f012a47643a95"
          }
        }
      }
    },
    // ...
]

Using jq:

$ brew info --json=v1 python | jq -r '.[]|.bottle.stable.files[]|.url'
https://linuxbrew.bintray.com/bottles/python-3.6.5.high_sierra.bottle.1.tar.gz
https://linuxbrew.bintray.com/bottles/python-3.6.5.sierra.bottle.1.tar.gz
https://linuxbrew.bintray.com/bottles/python-3.6.5.el_capitan.bottle.1.tar.gz

Note it works with multiple formulae:

$ brew info --json=v1 python git | jq -r '.[]|.bottle.stable.files[]|.url'
https://linuxbrew.bintray.com/bottles/python-3.6.5.high_sierra.bottle.1.tar.gz
https://linuxbrew.bintray.com/bottles/python-3.6.5.sierra.bottle.1.tar.gz
https://linuxbrew.bintray.com/bottles/python-3.6.5.el_capitan.bottle.1.tar.gz
https://linuxbrew.bintray.com/bottles/git-2.17.1.high_sierra.bottle.tar.gz
https://linuxbrew.bintray.com/bottles/git-2.17.1.sierra.bottle.tar.gz
https://linuxbrew.bintray.com/bottles/git-2.17.1.el_capitan.bottle.tar.gz

Upvotes: 1

Related Questions