Aero Wang
Aero Wang

Reputation: 9247

How to manually download brew package for installation?

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"

Upvotes: 10

Views: 11051

Answers (2)

fgoudra
fgoudra

Reputation: 881

If you use the -v option of brew upgrade or brew install or whichever command you used that needs to download the file, it will give you the output file where the downloaded file would have gone. You can then download your file manually to this place.

Upvotes: 2

Ortomala Lokni
Ortomala Lokni

Reputation: 62653

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.

Upvotes: 15

Related Questions