How to manually download brew package for installation?

大兔子大兔子 提交于 2021-01-03 05:53:43

问题


Being in China means sometimes you just can't upgrade brew packages via brew upgrade it would run into error as such:

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

I used to download these failed packages to ~/Library/Caches/Homebrew and then run the command again but this seems to work no longer after brew changed its cache structure for the better or worse (worse for me apparently).

What can I do now if I want to keep using brew to upgrade all my packages?

After I tried your method, this is the error that pops up:

==> 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

Also, say if I download go from https://dl.google.com/go/go1.11.4.src.tar.gz and rename it to go--git, which is the output of brew --cache go, but it still failed the installation.

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

If I run brew --cache go--gotools, it will say Error: No available formula with the name "go--gotools"


回答1:


If, for example, you want to upgrade Gradle, you can find the location and the name of the cached file expected by Homebrew with:

brew --cache gradle

You will obtain:

/Users/myself/Library/Caches/Homebrew/downloads/ae76f5a0a19f5c141d5ee602a2ecb45011393fbba2206f3a960599d7bba92b9b--gradle-5.0-all.zip

Extract the url of the zip file from:

brew edit gradle

Download the file and rename it as in the output of brew --cache

You can then upgrade Gradle even offline with:

brew upgrade gradle

Depending on formulas, you will have to manually install all their dependencies.



来源:https://stackoverflow.com/questions/53551665/how-to-manually-download-brew-package-for-installation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!