Compile wget on Mac OS X

There’s a precompiled wget available on the net, but it’s not automatically accepting StartSSL’s certificates. And as it seems, there’s a wget update available that did.

This is what I had to do to compile it on my Macbook Pro;

  • Install Xcode, if you haven’t, and be sure to select UNIX Dev Support.

Or you’ll get this error:

configure: error: C compiler cannot create executables
  • Export Xcode’s gcc PATH:
PATH=/Developer/usr/bin/:$PATH
  • Download wget
  • In Terminal: untar it
tar xvzf wget-latest.*
  • And compile it
cd wget directory
./configure
make
sudo make install
  • In case you had an old (precompiled) wget installed;
    remove that version first (/usr/bin/wget probably).
    By default, this one will install itself in /usr/local/bin/wget which should be in your $PATH as well (in case it’s not, make a symlink from the old /usr/bin/wget to /usr/local/bin/wget, or recompile with other installation directories).

4 comments

  1. Cedar says:

    Hello,

    I’m still getting the error message “configure: error: C compiler cannot create executables”, even if I set the correct PATH variable. I noticed that the “gcc” can be found.
    Here is the detail:

    “checking for gcc… gcc
    checking whether the C compiler works… no
    configure: error: in `/Users/cedar/wget-1.13.4′:
    configure: error: C compiler cannot create executables
    See `config.log’ for more details”

    And I check the config.log and found the following snippet:

    “configure:4339: gcc -V >&5
    gcc-4.2: argument to `-V’ is missing
    configure:4350: $? = 1
    configure:4339: gcc -qversion >&5
    i686-apple-darwin10-gcc-4.2.1: no input files
    configure:4350: $? = 1
    configure:4370: checking whether the C compiler works
    configure:4392: gcc conftest.c >&5
    ld: library not found for -lcrt1.10.6.o
    collect2: ld returned 1 exit status
    configure:4396: $? = 1
    configure:4434: result: no”

    I suspect the error has something to do with “ld: library not found for -lcrt1.10.6.o”. But I’m not sure what is going on. Can some one help me on this?

    Thanks in advance!

    Cedar

  2. Yeri Tiete says:

    This is because “gcc” is not installed.

    Download and install Xcode, and select “Unix Dev Support” (https://static.0x04.com/2011/03/Screen-shot-2011-02-18-at-12.14.18.png).

  3. Krinkle says:

    Though things have changed since 2011, this blogpost helped me to get on the right track. Here’s a few updates notes for, as of writing, Xcode 4.4.1 running on Mac OS X 10.8.1 Mountain Lion:

    * Start Xcode (get or update from the Mac App Store)
    * Xcode menu: Preferences, Tab: Downloads
    * Install “Command Line Tools”.

    Also, the bin directory has changed location. It is no longer at /Developer/usr/bin. The new location (which should be in your Terminals’ PATH, instead of /Developer/usr/bin):

    /Applications/Xcode.app/Contents/Developer/usr/bin

    I originally pursued this to install wget. In the ./configure step it erred on:
    > configure: error: C compiler cannot create executables

    Going through the above solved that problem.

  4. Yeri Tiete says:

    Cheers,

    That indeed helped. I upgraded my Snow Leopard to Mountain Lion over the weekend, and that was one of the things I still had to figure out! 🙂

Leave a Reply...