如何手动下载brew包进行安装?

Aer*_*ang 5 homebrew

在中国意味着有时你无法通过 brew upgrade 升级 brew 包,它会遇到这样的错误:

curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to cli-assets.heroku.com:443 
Error: An exception occurred within a child process:
  DownloadError: Failed to download resource "heroku"
Download failed: https://cli-assets.heroku.com/heroku-v7.18.10/heroku-v7.18.10.tar.xz
Run Code Online (Sandbox Code Playgroud)

我曾经将这些失败的包下载到 ~/Library/Caches/Homebrew ,然后再次运行该命令,但在 brew 改变其缓存结构后,这似乎不再起作用(显然对我来说更糟)。

如果我想继续使用 brew 升级我的所有软件包,我现在该怎么办?

在我尝试了你的方法后,这是弹出的错误:

==> Upgrading heroku/brew/heroku 
==> Installing dependencies for heroku/brew/heroku: heroku/brew/heroku-node
==> Installing heroku/brew/heroku dependency: heroku/brew/heroku-node
==> Downloading https://cli-assets.heroku.com/homebrew/node-11.3.0.tar.xz

curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to cli-assets.heroku.com:443 
Error: An exception occurred within a child process:
  DownloadError: Failed to download resource "heroku-node"
Download failed: https://cli-assets.heroku.com/homebrew/node-11.3.0.tar.xz
Run Code Online (Sandbox Code Playgroud)

另外,假设我下载 go fromhttps://dl.google.com/go/go1.11.4.src.tar.gz并将其重命名为go--git,这是 的输出brew --cache go,但安装仍然失败。

fatal: unable to access 'https://go.googlesource.com/tools.git/': Failed to connect to go.googlesource.com port 443: Operation timed out
Error: An exception occurred within a child process:
  DownloadError: Failed to download resource "go--gotools"
Failure while executing; `git clone --branch release-branch.go1.11 https://go.googlesource.com/tools.git /Users/aero/Library/Caches/Homebrew/go--gotools--git` exited with 128. Here's the output:
Cloning into '/Users/aero/Library/Caches/Homebrew/go--gotools--git'...
fatal: unable to access 'https://go.googlesource.com/tools.git/': Failed to connect to go.googlesource.com port 443: Operation timed out
Run Code Online (Sandbox Code Playgroud)

如果我跑brew --cache go--gotools,它会说Error: No available formula with the name "go--gotools"

Ort*_*kni 14

例如,如果您想升级 Gradle,您可以使用以下命令找到 Homebrew 所需的缓存文件的位置和名称:

brew --cache gradle
Run Code Online (Sandbox Code Playgroud)

您将获得:

/Users/myself/Library/Caches/Homebrew/downloads/ae76f5a0a19f5c141d5ee602a2ecb45011393fbba2206f3a960599d7bba92b9b--gradle-5.0-all.zip
Run Code Online (Sandbox Code Playgroud)

从以下位置提取 zip 文件的 url:

brew edit gradle
Run Code Online (Sandbox Code Playgroud)

下载文件并将其重命名为输出中的名称brew --cache

然后,您甚至可以使用以下命令离线升级 Gradle:

brew upgrade gradle
Run Code Online (Sandbox Code Playgroud)

根据公式,您将必须手动安装它们的所有依赖项。