Install wget in Mac OS X Without Homebrew or MacPorts

May 22, 2012 - 34 Comments

Install wget in Mac OS X

The command line tool wget lets you retrieve a group of files from FTP and HTTP protocols, it’s a very useful utility for web developers and powerusers to have around because it lets you do things like perform quick and dirty site backups and even mirror websites locally.

This approach is going to build and install wget in OS X from source, this means you’ll need Xcode and the Unix dev tools (free @ Mac App Store) installed, but it has the benefit of eliminating the need of a package manager like Homebrew or MacPorts.

For those who don’t have the Command Line Tools package from Xcode installed yet, it’s fairly simple: Open XCode, then go “Preferences” and to the downloads section, and choose “Install Command Line Tools”, or you can get it from the Apple Developer Site as described here. Because the package has to download from Apple, it may take a while depending on your internet connection. Command Line Tools installs a C compiler, GCC, and many other helpful utilities that are commonly used in the unix world.

How to Install wget in OS X

Moving ahead and assuming you have Xcode and the command line tools installed, launch Terminal and enter the following commands as shown.

First, use curl to download the latest wget source:
curl -O http://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz

Or to use an older version (prior versions of OS X)
curl -O http://ftp.gnu.org/gnu/wget/wget-1.13.4.tar.gz

(sidenote: a new version of wget may be available, version 1.15 is confirmed compatible with OS X Mavericks, while 1.13.4 has been confirmed compatible with OS X Mountain Lion. You can pick whichever one you want from the http://ftp.gnu.org/gnu/wget/ directory if you want a different version)

Next we use tar to uncompress the files you just downloaded:
tar -xzf wget-1.15.tar.gz

Use cd to change to the directory:
cd wget-1.15

Configure with the appropriate –with-ssl flag to prevent a “GNUTLS not available” error:
./configure --with-ssl=openssl

Build the source:
make

Install wget, it ends up in /usr/local/bin/:
sudo make install

Confirm everything worked by running wget:
wget --help

Clean up by removing wget source files when finished:
cd .. && rm -rf wget*

You’re all set, enjoy wget in Mac OS X.

The latest version of wget should configure, make, and install fine in OS X Yosemite as well.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: William Pearson in Command Line, Mac OS X, Tips & Tricks

34 Comments

» Comments RSS Feed

  1. NiX says:

    I don’t think you’d need Xcode for that, Command Line Tools for Xcode would do the job.

    Btw, why’d you need wget? Won’t curl suffice?

  2. curl ftw says:

    Why not just use curl? It does the same duties, in fact you use it in the article walkthrough for downloading the original source, heh…

  3. Floris says:

    On a fresh installation of OSX Lion I get
    configure: error: no acceptable C compiler found in $PATH

    • Onerti says:

      You need to install Xcode and Unix Dev Tools, you can’t compile code from source without gcc installed.

  4. James says:

    I used to do the whole download, tar zxvf, configure, make, make install process and it’s simply not worth it. Not when it’s easier to copy and paste the Homebrew installation script to the Terminal once and then simply issue “brew install wget” and suddenly, you have wget installed and working. You are bound to find other items missing from OS X that can be installed with Homebrew.

    Plus you can easily update what you’ve installed with brew when new releases or security issues are fixed. The only downside to Homebrew is that it doesn’t seem to work well with multiple local user accounts. The /usr/local folders get owned by one user. So if you do switch user accounts you’ll need to “su – admin” where admin is the account you installed brew with. Regular users can run the programs installed by brew but they can’t install other brew recipes nor update brew itself. Some users have assigned an admin group to /usr/local so any administrator level user can work with brew commands.

    Homebrew is an easier to use system than Macports and both are package managers. Redhat and Debian pretty much invented the concept of package management where users could pull packages from a repository and the installation would be heavily automated. Windows Update didn’t exist at the time and I think only Netware had something even remotely close. Nowadays you can setup a virtual farm of developer workstations and automate the entire process of generating new virtual machines and configuring their software via puppet scripts and yes driving brew commands via puppet as well. This ensures all the workstations are consistent in their configurations and software versions, etc. Doing things by hand is tedious and error prone.

    So if you are one guy with one computer that you own and manage yourself, sure, go right ahead and manually download, configure, compile, and install each and every single Unix/Linux application. I remember having to do this to install Netscape or the Gimp. Examining ./configure –help to ensure I was passing the right parameters and options, etc. Struggling with dependencies between applications using different versions of the same libraries. Creating symbolic links from newer library versions to an older library version required by a single application. It’s just plain painful, especially if you have to do that to 300+ computers on a regular basis. So if it’s good enough for the SysAdmins it’s good enough for anyone! After all, SysAdmins are lazy and didn’t we buy Mac’s to make things easier? Wasn’t that the point? Otherwise, I might as well be running a Slackware Linux distro from 1992!

    Do yourselves a favor and use a package manager such as Macports or Homebrew and avoid manually downloading, compiling and installing software. But if for some reason you have to do it, change the default path via the .configure.sh from /usr/local to /opt/local which isn’t used that much and keeps the individual manual installations away from the automated ones.

  5. NiX says:

    Hey you all! Stop installing Xcode if you don’t need a full and pro IDE!

    Simply install Command Line Tools for Xcode, it’s packed with gcc and some Apple’s header files. It is simple, easy, AND official. It delivers what you want only: gcc.

  6. prabin says:

    thanks alot for usefull info

  7. Drew says:

    Haha, my first build :)
    Extremely easy, worked great. Thanks!

  8. Noogrub says:

    Thanks for the help!

  9. Randy says:

    Thanks – this was helpful!

  10. cf says:

    Assuming you have already installed xcode tools:

    curl http://ftp.gnu.org/gnu/wget/wget-1.14.tar.xz > wget-1.14.tar.xz &&
    tar xpJf wget-1.14.tar.xz &&
    cd wget-1.14 &&
    ./configure –prefix=/usr/local && make -j8 && sudo make install

    done!

  11. cf says:

    werps! need –with-ssl=openssl too :)

  12. Robyn says:

    OK, so I got hung up with the ‘no acceptable C compiler found in $PATH’ error too. Turns out with Lion (or Mountain Lion in my case) you have to do it a little differently.

    1. Install Xcode
    2. Launch Xcode, authorize it and so on
    3. Go to preferences> downloads and install command line tools

    after that you should be able to follow the commands listed here without issue… but check for the latest version since the one in the original post is a little out of date

  13. Patrick says:

    Can’t get any simpler than that.

    Most ‘how tos’ are overly complex and over bloated. This was perfect. 2 minutes to install wget, thanks :)

  14. Joe Doe says:

    Thanks a lot, that was quick. Kind of dumb question but… how to uninstall?
    Just run
    $sudo rm /usr/local/bin/wget
    And wget is gone forever and ever? Or is it anything else that needs removal?

  15. Gene says:

    This worked great for me. I wasted so much time trying to install wget before I found your instructions, but nothing else seemed to work. Thanks so much!

  16. I just don’t want to install Homebrew or Macports just to have wget. Thanks for this guide.

  17. Massimiliano says:

    Thanks it worked like a charm

  18. Singham says:

    everything was fine until i typed “wget –help”, the return message was, “-bash: wget: command not found”. Any idea what i could be doing wrong guys? I installed x-code, macports, and command line tools already.

  19. Justus Beyer says:

    Worked perfectly on Mountain Lion. The more recent wget version 1.14 didn’t compile though.

    Thanks a lot!

    Justus

  20. Simon says:

    Thank you sir. Had to install Xcode but was going to anyway.

  21. kraz says:

    Thanks a lot!
    This helped me….

  22. momer says:

    Thank you, that worked!

  23. Sergio says:

    Bravo! Worked like a charm, thank you :)

  24. DewaKoding says:

    I’ve tried on my Mac Mavericks and Works like a charm! Thank you for posting.

  25. Kathy says:

    Thank you! This worked great.

  26. Alex says:

    Awesome ! Many thanks

  27. Martin says:

    Great guide!

    Successfully compiled the latest wget v.1.15, ML 10.8.5, Xcode 5.0.2, command_line_tools_October_2013, but needed to do a quick tweak (previously had Xcode 4.x):

    sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

    To solve “can’t build binary” error ” see … config.log for more details” on first step: ./configure –with-ssl=openssl

    Thank you!

    • Joe McCarthy says:

      FWIW, I have Xcode 5.1.1 (& command line tools) installed and was able to successfully install wget 1.5 on OS X 10.8.5 without having to make any changes in the original instructions above.

  28. ashorlivs says:

    Thank you for this tips, works great under X.8.5 :)

  29. JR Fent says:

    THANK YOU! Great instructions!

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates