7

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"

Aero Wang
  • 8,382
  • 14
  • 63
  • 99

2 Answers2

14

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.

Ortomala Lokni
  • 56,620
  • 24
  • 188
  • 240
  • It seems to work with gradle, but failed when it comes to heroku. – Aero Wang Dec 03 '18 at 02:22
  • It's not a problem from Homebrew, you just don't have network access to the needed file. You could try to find a copy somewhere. – Ortomala Lokni Dec 03 '18 at 08:15
  • actually i do and i have downloaded the needed files. i think they probably need to go into other places. if i use a proxy to install heroku it doesnt download the file to Homebrew's cache folder. – Aero Wang Dec 04 '18 at 00:27
  • 1
    You have to change the location and rename the file you have downloaded. For the current version, heroku should be at `~/Library/Caches/Homebrew/downloads/502c1a8a9eda3fb68d67d588c520326776f6212e086f9f26009bda08761aec1e--heroku-v7.19.1.tar.xz` – Ortomala Lokni Dec 04 '18 at 08:14
  • heroku depends on heroku-node. Running brew --cache heroku-node shows /Users/myself/Library/Caches/Homebrew/downloads/d0f9f58aef7c0f3840546c2897aa2fce60c66a2835d2ccfe2a1c6c7ad8503c46--node-11.3.0.tar.xz. You will have to download node-11.3.0.tar.xz and place it at the right location. – Ortomala Lokni Dec 06 '18 at 08:10
  • That works for heroku but failed again when I tried go, please see the updated question. – Aero Wang Dec 17 '18 at 02:49
1

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.

fgoudra
  • 751
  • 8
  • 23