Ursine rambling and grumbling

The wget utility recently came up in a JavaRanch topic and I recalled that this very useful utility doesn't come natively installed on Mac OS X, even if you install the Developer Tools.

I also recalled that it took me less than 10 minutes to download the sources and build it.

Figuring that I should probably rebuild the latest and greatest, here are the steps I took to build wget 1.9 on Mac OS X 10.3.8 with the Developer Tools installed:

  1. Get the source from ftp://ftp.gnu.org/pub/gnu/wget/wget-1.9.tar.gz
  2. Unpack the tarball: tar xzf wget-1.9.tar.gz
  3. This creates a folder named wget-1.9. Change the working folder to it: cd wget-1.9/
  4. Configure the build: ./configure
  5. Build: make
  6. Install: sudo make install
  7. The wget binary should now be in your /usr/local/bin folder.


howdy, I stumbled across this googling for "wget osx"... I'm on 10.3.5 at work, and I had to use "./configure --without-ssl" to get it to compile right.
I'm on 10.3.8 and didn't have an issue compiling with the instructions stated.
i can't seem to get it to work either way. I try compiling it, and it seems to compile fine, "wget" appears in /usr/local/bin. but when i try and call the command it gives me a "-bash: wget: command not found"
It doesn't matter where you put it as long as where you put it is in your $PATH. To the person who couldn't get it to work after seeing it in /usr/local/bin, make sure you actually have /usr/local/bin in your path and log back into your shell. Your shell won't know about the addition until you log back in. (There is also a command for reloading, but I can't remember what it is.) To the person who had to use sudo make, it's simply a permissions issue. When you use the default make, you have to make sure your user has adequate permissions on all the directories/files it's trying to access. sudo make will temporarily act as root so you won't have permission issues.
I don't have gcc or any of compile stuff. Where I can get it?
You should be able to grab the developers tools from the Apple web site if you not longer have the install disk that came with the OS.
Ashton: /usr/local/bin/ isn't in your path by default. either copy wget to /usr/bin/ or add /usr/local/bin/ to your path.
I do that(/usr/local/bin/wget http://www.download.com), and it works. Is there any way that i can avoid this? If you type "alias wget=/usr/local/bin/wget" it works, but you have to type that in everytime you open a new terminal for it to work right. SHouldn't i be able to call wget by typing "wget url"?
Put /usr/local/bin in your .bash_profile (this is assuming that you're using the bash shell). 1. Create a .bash_profile file (if you don't already have one). You can either 'touch .bash_profile' or use any text editor to do it. 2. Edit the path so that it reads "PATH=$PATH:/usr/local/bin". 3. Make sure that the PATH variable is exported. On another line, add "export PATH". You can now "source .bash_profile" to get it working with the current terminal. Now every time you start the terminal, /usr/local/bin will be in the path.
Thanks! I needed that clue on .bash_profile for adding to the PATH. Oy!
Hi Bear, are you familiar with curl? A year ago I was writing a script that grabbed something from a web site, and for some reason it was a lot easier to do with curl than with wget. Sorry I can't be more specific; it's been too long.
Actually, though I've heard of it, I haven't looked into curl. Perhaps when I get a few moments... Thanks.
After I use the make command I end up with the following, /bin/sh ../libtool --mode=link gcc -O2 -Wall -Wno-implicit -o wget cmpt.o connect.o convert.o cookies.o ftp.o ftp-basic.o ftp-ls.o ftp-opie.o hash.o headers.o host.o html-parse.o html-url.o http.o init.o log.o main.o gen-md5.o netrc.o progress.o rbuf.o recur.o res.o retr.o safe-ctype.o snprintf.o gen_sslfunc.o url.o utils.o version.o -lssl -lcrypto -ldl mkdir .libs gcc -O2 -Wall -Wno-implicit -o wget cmpt.o connect.o convert.o cookies.o ftp.o ftp-basic.o ftp-ls.o ftp-opie.o hash.o headers.o host.o html-parse.o html-url.o http.o init.o log.o main.o gen-md5.o netrc.o progress.o rbuf.o recur.o res.o retr.o safe-ctype.o snprintf.o gen_sslfunc.o url.o utils.o version.o -lssl -lcrypto -ldl ld: Undefined symbols: _OpenSSL_add_all_algorithms make[1]: *** [wget] Error 1 make: *** [src] Error 2 Any ideas????? Thx!
ok I solved it (not sure if correctly) using sudo make instead of just make... any comments?? Thx Felipe
Is there any reason for putting it into /usr/local/bin? I should have thought /bin/ was a more natural place to put it, since there are already lots of cmdline tools there.
/usr/local/bin/ is for your 'local' command line tools. That is to say, those -you- installed versus those installed by default.
I got wget to build fine. however i was a little miffed at the fact I had to sim link the man page.... for those who wish to know what I did to get it to show using man wget: cd /usr/share/man/man1 sudo ln -s /usr/local/man/man1/wget.1 wget.1 I did not see any mention to this but i dont have enough brain to remember all the options for all the stuff I know.... thats why god invented man pages
Always remember to type "rehash" after installing something so that the binaries already in your path, but newly added, are added to the list.
the wget binary is in my /usr/local/bin folder...but i still cannot use it. when i attempt to use it, i get a "wget command not found". i believe it wasnt installed correctly but i followed the steps exactly. im using tiger if that effects anything. any help?
>but i still cannot use it.

At the command prompt, type:

echo $PATH

Is /usr/local/bin one of the paths on the list? (the list is colon-separated)

Or better yet.. change into the /usr/local/bin directory and execute from there to make sure it is indeed a $PATH issue or if the binary just doesn't work. cd /usr/local/bin ./wget www.google.com If that works you built it correctly and you just need to add /usr/local/bin to your $PATH so you can execute the command without being in /usr/local/bin. If it doesn't work, there is an issue with the binary file.
Ok i checked the path and it wasnt in there. so i used # export PATH=$PATH:/usr/local/bin. and when echoed it was there. Now when i open a new shell and echo, the path is back to normal. Apparently its only being added for the sesssion. Is there a way to permanatly add it to the PATH env.
Add the export to your .bash_profile.
using tiger and wget-1.10. when i run /.configure it errors saying: error: no acceptable C compiler found in $PATH

Do you have the developer tools installed?

I do not believe that the C compiler comes with the base installation.

that is probably it. thanks.
Hi everybody, I'd like to install a path for wget, but i have no idea of how i could do that. Any suggestions? Anne-So
installed the developer tools and all is well, now. thanks again.
i'm confused, So i follow the steps sudo make install. go back to root ...cd /usr/local/bin ...dir it tells me "no such file or directory" anyway so i'm really confused. what should i be doing next. what do i do with the wget in the /usr/local/bin? what is all this about the $PATH? please help. thanks
I don't mean to sound rude or elite, but if you don't know what $PATH is or how to execute something from a command line, why are you trying to use wget? What do you need it for?
if you are the administrator BUT NOT ROOT USER, simply do: 1) unzip the source file 2) cd wget*** *** being the version 3) ./configure 4) make 5) make install 6) you are done, to use wget, simply open a terminal and type "wget link" to download the link to the current directory hope this helps the confused folks out there P.S. This is tested to work on OSX 10.4.2
Bear's instructions at the top of the thread work great in 10.3.9. Had to cd to /usr/bin and create a symlink with sudo ln -s /usr/local/bin/wget wget to get it to run.
I'm having trouble with the installation on my G5. When I run the ./configure command I get : configuring for GNU Wget 1.9 checking build system type... powerpc-apple-darwin7.9.0 checking host system type... powerpc-apple-darwin7.9.0 checking whether make sets $(MAKE)... yes checking for a BSD-compatible install... /usr/bin/install -c checking for gcc... gcc checking for C compiler default output... configure: error: C compiler cannot create executables See `config.log' for more details. The .log file indicates that the failure is occurring with line 2044, but I'm not sure how to fix this problem. Any help would be greatly appreciated.
C compiler cannot create executables See `config.log' for more details.
I was getting this error because I was trying to do a minimal install of xcode tools. I just wanted to compile command line programs. After fiddling a bit, this is what I needed to include in the custom setting of the xcode install.
- Developers Tools SOftware
- gcc 4
- gcc 3.3

Software Dev Kits
 - Mac OS X SDK
 - BSD SDK
@bendy: thanks for the tip! I was trying to do a minimal install of XCode too and was having some trouble with GCC. thanks!
I can't get wget to compile for Tiger. I get the following output: checking build system type... Invalid configuration `unknown-apple-darwin8.0.0': machine `unknown-apple' not recognized configure: error: /bin/sh ./config.sub unknown-apple-darwin8.0.0 failed Any suggestions? Thanks!
For those that are having trouble building wget, you might want to use curl instead. Not sure about releases prior to 10.4, but it is defintely included by default in 10.4.x if you installed the BSD subsystem. For more information, open a terminal and type 'man curl'. -digitalshadow
Hi I have just built wget for Tiger. You just have to use newest updates and dev-tools and everything works fine!!
wget is up to 1.10.1 now
I am not sure if this is the place to post this, but considering wget isn't included in OSX or xCode Dev Tools, are there other UNIX commands omitted from the installs that one might expect are included but are not? Thanks.
I didn't expect wget to be installed to begin with. I think the first time I've seen it bundled with any OS distro is after RedHat 6 or 7. Especially now that curl is included, wget will probably be depricated at some point. What other apps did you have in mind?
ownage thanks a ton sir, just built 1.10 in like a minute with tiger!
Thank you.
I compiled wget 1.10.2 under Tiger 10.4.3 with no trouble at all. However, it doesn't provide the feature I need, so I'm sticking to curl.

-----
Check out the BARTsmart BART Widget for Mac OS X, featuring BART train schedules and news.
I can almost get this to work, but when calling sudo make install it says "sudo: must be setuid root" What does that mean and what might I need to do?
it's working fine on 10.4.3 with Xcode/Developer Tools (gcc) installed.
Has anyone tried building a newer version of wget (> v1.9)?
Yep! Works great. Thanks. Just built 1.10.1 on Tiger 10.4.4. So simple
Try Fink Commander Just three clicks and there it is....
thank you very much for this bit info. this worked great OS X 10.3.9. your build instructions and this $PATH tid-bit is what was needed for a successful install. Put /usr/local/bin in your .bash_profile (this is assuming that you're using the bash shell). 1. Create a .bash_profile file (if you don't already have one). You can either 'touch .bash_profile' or use any text editor to do it. 2. Edit the path so that it reads "PATH=$PATH:/usr/local/bin". 3. Make sure that the PATH variable is exported. On another line, add "export PATH". You can now "source .bash_profile" to get it working with the current terminal. Now every time you start the terminal, /usr/local/bin will be in the path.
For this project and any other UNIX source project, I get on an intel Mac this error message:

>>>
configuring for GNU Wget 1.9
checking build system type... i386-apple-darwin8.5.1
checking host system type... i386-apple-darwin8.5.1
checking whether make sets $(MAKE)... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for gcc... gcc
checking for C compiler default output... configure: error: C compiler cannot create executables
See `config.log' for more details.
>>>

I'm lost. Don't know, why I can't any longer compile from the command line...

And ideas?

CU,

s
Currently it's ftp://ftp.gnu.org/pub/gnu/wget/wget-1.10.2.tar.gz It just compiled fine on 10.4.5
Thanks, Bear! (And everyone else who had trouble with the $PATH stuff - I don't have bash installed on this laptop) And thanks to Anonymous who posted the symlink directions (sudo ln -s /usr/local/bin/wget wget) - On my birthday last year, no less! :)
It works also perfectly on OSX 10.4.6
with developer tools Xcode 2.1
perfect! Thanks!
Thanks! This is exactly what I needed -- quick and with directions that worked.
Thank you! A year and a half after your post, you're still serving the community :) I've been using Linux for over ten years, but am still figuring out Mac OS X, esp. when/how behavior matches or differs from Linux. Your post helped.
I got it to build and install on OS X 10.4.8, and to place the man pages in the proper location:
./configure --mandir=/usr/local/share/man
make
make install
This is awesome! Thanks a ton!
Thanks, Shlomo! That's exactly what I was wondering. I noticed a lot of other installers have put manpages in /usr/local/man too. How can I add that directory to my manpath? Or should I just move all that stuff to /usr/share/man? Shlomo Swidler wrote: > I got it to build and install on OS X 10.4.8, and to place the man pages in the proper location
THANK YOU for the blog! It TOTALLY helped me to get.. wget working on my MacOSX 10.4.8. I had made some common errors: not a full install of the -proper- Dev Tools (I had an old disk, so then I downloaded the latest after that to be able to compile), and also I had to do a "symlink with sudo ln -s /usr/local/bin/wget wget to get it to run" --as did the other poster above. I'm a happy camper, thanks to Bear and you dudes here.

ps. I had cURL recommended to me too, but I have scripts all setup for wget, which I also script through. WGET is my champ.

PEACE, Pix :.
The man page issue is a matter of OS X by default not including /usr/local/man in the MANPATH. To fix for all users simply "sudo vi /usr/share/misc/man.conf" and add "MANPATH /usr/local/man" to the line following "MANPATH /usr/local/share/man".
Check this out: After going to the trouble of installing all the new XCode/GCC/etc.. on my MacOSX 10.4.8 and building/compiling WGET.. I found I could just copy the executable to run on my 10.3 OSX.. no problemo. Not sure if it's 10.3 or a 10.2 upgraded to 10.3, but the proper directory was /usr/bin on the older OSX.
configure --infodir=/usr/share/info --mandir=/usr/share/man --bindir=/usr/bin --sysconfdir=/etc; make; sudo make install
also works. You don't need to change any configuration file, environment variable, symbolic link...
I'm using OS X Version 10.4.9 and everything went smooth. I have the developer tools installed. Thanks for the info!
Is having XCode installed a pre-requisite? I don't have Xcode installed and I receive the following error: GOMacmini:~/SafariDLs/wget-1.9 go$ ./configure configuring for GNU Wget 1.9 checking build system type... powerpc-apple-darwin8.10.0 checking host system type... powerpc-apple-darwin8.10.0 checking whether make sets $(MAKE)... no checking for a BSD-compatible install... /usr/bin/install -c checking for gcc... no checking for cc... no checking for cc... no checking for cl... no configure: error: no acceptable C compiler found in $PATH See `config.log' for more details.

You don't need Xcode per se, but you do need the C compiler. I'm pretty sure that you need to install the Dev Tools (which includes Xcode) to get that.

I always automatically install the dev tools after an OS install, so I'm not sure what comes with the OS and what comes with the dev tools.

Actually, i compiled it like this: ./configure --prefix=/usr make sudo make install No problems with $PATH at all :) (I compile stuff all the time on Linux)


Add a comment

Title
Body
HTML : b, i, blockquote, br, p, pre, a href="", ul, ol, li
Math Quiz 3 + 8 = (Helps stop blog spam)
Name
E-mail address
Website
Remember me Yes  No 

E-mail addresses are not publicly displayed, so please only leave your e-mail address if you would like to be notified when new comments are added to this blog entry (you can opt-out later).

TrackBack to http://radio.javaranch.com/bear/addTrackBack.action?entry=1109829480523