为不同的macOS版本提供可用文件

时间:2018-05-28 11:53:28

标签: macos homebrew

以安装Python为例。

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

brew SW下载与我当前的macOS版本匹配的默认版本。 (在这种情况下,它适用于high_sierra(10.13.x)macOS)。 但我想获得以前的macOS版本的其他构建版本(例如10.10.x)。

我注意到所有从https://homebrew.bintray.com/bottles/下载的SW。 但遗憾的是,我无法查看https://homebrew.bintray.com/bottles/路径下的可用文件。

是否有命令查看不同macOS版本的可用文件(例如Python)?

1 个答案:

答案 0 :(得分:1)

您可以使用brew info --json=v1 <formula>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"
          }
        }
      }
    },
    // ...
]

使用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

请注意,它适用于多个公式:

$ 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