如何在自制软件上降级软件包?

How do I downgrade a package on homebrew?

对自制软件不太熟悉。我正在尝试通过 运行

jq 从 1.6 降级到 1.3.1
brew install jq@1.3.1

但我一直收到

Warning: No available formula with the name "jq@1.3.1".
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

作为我的错误响应。

我试过 brew install jq@1.3brew install jq=1.3brew install jq==1.3 都没有用。有什么建议吗?

jq 1.3 可以通过自制软件获得,但是 AFAICT,一个专门标记为 1.3.1 的版本不是。 (参见 https://stedolan.github.io/jq/download

获取特定版本的一种方法如下:

  1. 首先您可能想要卸载 jq:
brew uninstall jq
  1. 寻找合适的jq.rb 例如通过浏览 https://github.com/Homebrew/homebrew-core/commits/master/Formula/jq.rb

对于 jq 1.3,以下内容就足够了:

URL=https://github.com/Homebrew/homebrew-core/blob/9517da4a73f8eb9af8c8c217a52526f5edf428a2/Formula/jq.rb
  1. 获取并执行脚本
wget $URL  # or use curl

brew install -s jq.rb