2

I have problem downloading some applications with homebrew. I could get them when the download urls start with https://

but curl fails when the urls start with, ftp:// or http://

For example, I want to install GMT (generic mapping tools) with homebrew on my Mac OS 10.7.4. and I get the error below. I think curl has problem downloading .tar.gz file, but I have no problem downloading the same file with Firefox.

$ brew install homebrew/science/gmt
==> Tapping homebrew/science
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-science'...
remote: Counting objects: 553, done.
remote: Compressing objects: 100% (551/551), done.
remote: Total 553 (delta 2), reused 67 (delta 1), pack-reused 0
Receiving objects: 100% (553/553), 432.61 KiB | 367 KiB/s, done.
Resolving deltas: 100% (2/2), done.
Tapped 546 formulae (572 files, 2.9M)
==> Installing gmt from homebrew/homebrew-science
==> Installing dependencies for homebrew/science/gmt: cmake, libpng, gifl
==> Installing homebrew/science/gmt dependency: cmake
==> Downloading http://www.cmake.org/files/v3.3/cmake-3.3.1.tar.gz

curl: (7) couldn't connect to host

As a workaround, I downloaded the make-3.3.1.tar.gz file with Firefox and copied it to /Library/Caches/Homebrew/ and it worked. So I downloaded the .tar.gz files for each dependency. They all worked until downloading a .zip file proj-datumgrid-1.5.zip which looks like a data file used by the dependency proj.

Maybe I need to rename the .zip file downloaded somehow so that Homebrew recognize it. Or should I need to put it elsewhere . How does homebrew use these files?

$ brew install homebrew/science/gmt
==> Installing gmt from homebrew/homebrew-science
==> Installing dependencies for homebrew/science/gmt: proj, libgeotiff, geos, readline, sq
==> Installing homebrew/science/gmt dependency: proj
==> Downloading http://download.osgeo.org/proj/proj-4.9.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/proj-4.9.1.tar.gz
==> Downloading http://download.osgeo.org/proj/proj-datumgrid-1.5.zip

curl: (7) couldn't connect to host
Error: Failed to download resource "proj--datumgrid"
  • Are you doing this from work? Is it possible, that you have to use a proxy server? To check, you could take a look at the Firefox settings or ask your administrator. – nfechner Aug 21 '15 at 13:54
  • I'm at the university. Firefox uses Auto-detect proxy. – Nasolo Andrianoelina Aug 21 '15 at 14:12
1

Have you tried running

brew update

and

brew updgrade

before

brew install homebrew/science/gmt

Usually many problems with formulas may be solved by simply updating & upgrading homebrew and its formulas!

  • 1
    Yes I did brew update && upgrade before brew install homebrew/science/gmt. – Nasolo Andrianoelina Aug 21 '15 at 13:24
0

It's likely you are seeing a network issue. To test that, in the window where things errored out, try the host command to make sure DNS is happy and then try a basic curl to check the server is up.

host www.cmake.org
curl www.cmake.org | wc -l

The second command downloads the main page and counts the lines of text curl was able to retrieve. For me, I get:

www.cmake.org has address 66.194.253.19

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 28697    0 28697    0     0  53139      0 --:--:-- --:--:-- --:--:-- 53142
     426

... so curl retrieves 426 lines of code.

At that point, you know the tools are fine and can check the actual resource that brew is trying to download - in this case

maac:log miike$ curl http://www.cmake.org/files/v3.3/cmake-3.3.1.tar.gz | wc -l
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 6423k  100 6423k    0     0   554k      0  0:00:11  0:00:11 --:--:--  799k
   25239

The above command seems the same as using firefox, but if you get similar results from the command line, retry the brew install with a verbose flag to get extra debugging information:

brew install -v homebrew/science/gmt
  • I tried this and got $curl www.cmake.org | wc -l % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- 0:01:15 --:--:-- 0 curl: (7) couldn't connect to host 0 – Nasolo Andrianoelina Aug 21 '15 at 13:36
  • @NasoloAndrianoelina Nice - then your networking is the problem and not the brew. Try curl --connect-timeout 10 --retry 3 --verbose http://www.cmake.org/files/v3.3/cmake-3.3.1.tar.gz | wc -l but you'll likely need to ask a follow on question if you can't make sense of the output from that command. @ ping me here if you ask a new question on debugging curl :-) – bmike Aug 21 '15 at 14:55
  • 2
    Yes it was a networking problem and I could finally find a solution. The autodetect proxy was not working for curl and I asked the proxy from the administrator. From google: I added to the file '~/bash_profile' something like this 'http_proxy="mycache.mydomain.com:8080"' 'export http_proxy' – Nasolo Andrianoelina Sep 24 '15 at 7:44
  • 1
    Awesome news @NasoloAndrianoelina - I would encourage you to answer that as a separate answer. I can sepe lots of people being stumped by this. Especially as MDM can set proxy settings for people behind the scenes and they may not be aware they are set. – bmike Sep 24 '15 at 11:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .