Posted by & filed under OS X.

A pre-requisite for this to work is that you have the second disc of utilities that came with your Mac installed. This disc will provide a bunch of utilities required to compile code. Alternatively, you can Install Xcode from the App Store (it’s free!) and you will get all of the same utilities.

UPDATE: Installing Xcode is no longer good enough.You will now need to open Xcode, go to preferences (Cmd + ,), go to Downloads, and install the Command Line Tools feature. This installs a bunch of development tools onto your system.

Run the following commands in a terminal window to compile wget on OS X Lion:

curl -O http://ftp.gnu.org/gnu/wget/wget-1.13.4.tar.gz
tar -xzvf wget-1.13.4.tar.gz
cd wget-1.13.4
./configure --with-ssl=openssl
make
sudo make install
which wget #Should output: /usr/local/bin/wget

Note the with-ssl=openssl option in the command above. If you omit that, you will get the following error:

...
checking for compress in -lz... yes
checking for gpg_err_init in -lgpg-error... no
checking for gcry_control in -lgcrypt... no
checking for libgnutls... no
configure: error: --with-ssl was given, but GNUTLS is not available.
username@host:~/wget-1.13.4 $

The reason for this is that GNUTLS isn’t included with Mac OS X, but the equally usable library OpenSSL is available.

Thomas Hunter II

Thomas is passionate about technology and building products. A web design business created while attending college slowly evolved into a brick and mortar on Main St. of his small Midwestern hometown. His desire for fame and fortune led to the co-founding of a Y Combinator startup and a life in California.

Tags:

Hey there! I'm currently writing a book on Microservices which I expect to release in early 2017. If you're interested in getting updates please signup here. More info about the Book
  • How are we supposed to wget the file if we don’t have it…

    • Thanks for spotting it! I had aliased ‘wget’ to ‘curl -O’ in my .bash_profile. I updated the tutorial to use the proper command.

  • Tom

    Worked like a charm on Snow Leopard! Thank you!!

  • Ventola

    thanks very much for the openssl parameter, was supposed install gnutls libraries separately and found your post, thanks again.

  • Paul Demers

    It is also important to note that you need to have Xcode installed in order to run the make command. I had a little bit of trouble until I figured that out. Thanks for the tutorial!

    • Good point, I’ve started taking for granted that the machines I use have Xcode installed since I’ve been using them in pre-installed environments.

  • William

    Thanks a ton for the quick guide. Brand new to OSX, and didn’t realize that OpenSSL was the default SSL Package!

  • Ethan

    Thanks Tom! Worked perfectly.

  • George

    I’ve Xcode installed, but this error is happened:

    checking for gcc… no
    checking for cc… no
    checking for cl.exe… no
    configure: error: in `/Users/qqq/wget-1.13′:
    configure: error: no acceptable C compiler found in $PATH
    See `config.log’ for more details
    Qqq:wget-1.13 qqq$

    What kind of compiler i must using in OS Lion?

    • If you have Xcode, you should have gcc. I’m not sure why you wouldn’t have gcc. You might want to try installing the development tools which are on the second CD that came with your mac.

      • Joeri

        In Xcode 4.3 there is an option to download and install command line tools in the Preference panel.

      • Lauch XCode, go to Préférences then Downloads.
        Clic install on “Command line tools”.

        That’s all.

  • redsai

    Thanks for this. It was exactly what I needed, when I needed it.

  • Hossein

    helped! Thanks

  • Dave

    Thx for this…. “./configure –with-ssl=openssl”. I was pretty bummed about the prospect of having to use wget w/o SSL.

  • Gary

    The current version of Xcode no longer includes the command-line compilers and tools. These are a separate package that must be installed.

  • Nate

    For those running Lion and installing Xcode, once Xcode is installed you will need to then go to preferences and downloads and click install for command line tools. If you don’t then you will get the gcc no acceptable c compiler found error.

  • Ted

    If you install Xcode through the Mac App Store, you will not have the command line compilers installed. It is a separate download from Apple. Inside Xcode, got to Xcode > Open Developer Tool > More Developer Tools. That will launch the ADC website. Login, and download the Command Line Tools for Xcode (the latest version). That should give you the C compiler.

  • Pingback: wget on OS X Lion | Genius Tech Blog()

  • Ringel

    OsX gets worse and worse.
    In the past cam wget with it, on Lion not anymore.
    If I I need to drop a bunch of commands, I can also work on Linux… do that, read MAN page there and so on…

    Stuck on not having the make command/file on the machine. I can solve that, but not sure if I want to invest time to it.
    Expecting installer packages and not crappy command based installations.

  • BertoFett

    echo ‘alias wget=”curl -O”‘ >> ~/.bash_profile

    log out and log back in.

    Boom.

    • That alias will work for the simple uses of wget, but anything more complex (e.g. using different wget arguments) will fail. I was actually doing before making the jump and fully installing wget.

  • TJ

    Thanks! Worked brilliantly!

  • Thanks! Worked nicely! When I look at your command line, you don’t seem the have the commands separated by ; (not sure if this is because I am using Chrome, but I see a single command, rather than a series of commands…..

    • Nice catch… WordPress keeps breaking line breaks in old posts, and I have no idea why.

  • Thank you Thomas! Worked like a charm on Lion.

  • Thanks man! worked great.

  • Paul Mulroney

    Thanks for your post – worked first time!

  • Tim Kenington

    Thanks so much for your post – it was a huge time saver to have stumbled across your solution!

  • Peter Evans

    Worked like a charm on my MacBook Air with Lion 10.7.4. Thanks very much.

  • Thanks for the tips. It worked with openssl :)

  • Jim

    So simple … wish I had found your site first – only found this when trying to solve the GNUTLS issue … had cobbled together all the rest of the steps from a variety of older sites & blogs.

  • Quentin

    Thanks! Works great!

  • Matt

    Thanks for the tutorial – this was a great help!

  • vanni

    WTF!

    “Launch of “tar” failed: the PowerPC architecture is no longer supported.”

  • Thanks a lot for the detailed instructions, working great on Lion (10.7.4).

  • Worked great, thank you! -brewster

  • Thanks Thomas, I’m new to this kind of terminal action and it really helped me.

    A flawless installation on Mountain Lion here.

  • Lordrex

    Thanks man, I need to wget some files with OSX and this was the first link that came up and it worked like a charm, but yes you do need Xcode installed- which i would imagine anyone reading this blog with a MAC already does

  • Cynthia

    Thank you! I’m so glad u posted this! It worked well on Snow Leopard and saved me lots of time.

  • Steven

    Thanks for the tip about Mac OS X Lion’s Xcode’s Command Line Tools feature!

  • Lena

    Worked like a charm on Mountain Lion. Thanks!

  • Rachel

    Flawless! Thank you so much.

  • Brock Peters

    Awesome write up. I found it helpful. Works on Mountain Lion as well. I downloaded an even later version of wget.


    curl -O http://ftp.gnu.org/gnu/wget/wget-1.14.tar.gz

  • Michiel

    Thanks for this post. It worked without a problem on Mountain Lion and wget 1.14.

    I had to do a chmod 755 /usr/local/bin before my user account could access it though. Otherwise I would have to use SUDO each time.

  • Tim

    You don’t need XCode to get the Command Line Utils btw, they are available as a separate download on developer.apple.com

  • Xu Yue

    That’s awesome! Thank you Thomas!

  • Pablo

    Thanks! Worked like a charm. I’ve downloaded the command line tools without the xcode big package.

    • The alternative is amazing as long as one doesn’t need Xcode.

  • Works like a charm with OSX 10.6.8 Snow Leopard.
    Thanks Thomas!

  • hudy

    nice!!! very good!!! tanks

    \o\|o|/o/

  • Awesome tut, thanks!

  • Never thought about using openssl. Thanks for sharing the solution!

  • Great information. I was able to successfully install wget. Thanks!

    -Mike

  • Woo I love it when a plan comes together.

    1 – Google “install wget mac”
    2 – Visit top 5 results
    3 – Close all but the prettiest page
    4 – Follow instructions
    5 – Appreciate clever author pointing out SSL error, follow instructions again
    6 – Use wget
    7 – Give thanks to clever author.

    Thanks!

  • Dan

    Thanks so much for these instructions. I’m an absolute n00b when it comes to working in the Terminal and your instructions were foolproof.

  • Mark

    Hey Thomas, Just wanted to say thanks for posting this as I too had to go through this after a recent Snow Leopard upgrade. However, I just discovered HomeBrew through github, and the very first thing they demonstrate what it can do is to install wget, which (no offense) seems like perhaps the simplest way to install wget as it completely bypasses XCode (which I don’t use currently) and is blazingly simple. Posting here in the hopes that it helps

    http://mxcl.github.com/homebrew/

  • Sweet. Thanks. It’s a pretty key program on Linux and I was starting to miss it on my Mac.

  • mariomka

    ty

  • Scott

    Quick and painless. Thanks, sir.

  • Armando

    Are you looking for the binaries of wget for MacOSX without having to install Homebrew or MacPorts? Or to build the binaries yourself with XCode? http://www.utilsforge.com/wget.html