Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OS X: equivalent of Linux's wget

How can I do an HTTP GET from a Un*x shell script on a stock OS X system? (installing third-party software is not an option, for this has to run on a lot of different systems which I don't have control on).

For example if I start the Mercurial server locally doing a hg serve:

... $ hg serve  

And then, from a Linux that has the wget command I do a wget:

... $  wget http://127.0.0.1:8000 --2010-12-31 22:18:25--  http://127.0.0.1:8000/ Connecting to 127.0.0.1:8000... connected. HTTP request sent, awaiting response... 200 Script output follows Length: unspecified [text/html] Saving to: `index.html 

And on the terminal in which I launched the "hg serve" command, I can indeed see that an HTTP GET made its way:

127.0.0.1 - - [30/Dec/2010 22:18:17] "GET / HTTP/1.0" 200 - 

So on Linux one way to do an HTTP GET from a shell script is to use wget (if that command is installed of course).

What other ways are there to do the equivalent of a wget? I'm looking, in particular, for something that would work on stock OS X installs.

like image 793
SyntaxT3rr0r Avatar asked Dec 31 '10 20:12

SyntaxT3rr0r


People also ask

What is the equivalent of wget in Mac?

Other interesting Mac alternatives to Wget are cURL, ArchiveBox, HTTPie and webui-aria2. Wget alternatives are mainly Download Managers but may also be Website Downloaders or HTTP Clients.

Does macOS have wget?

While wget doesn't ship with macOS, you can download and install it using Homebrew – the best Mac package manager available.

What can I use instead of wget?

The best alternative is aria2, which is both free and Open Source. Other great apps like Wget are uGet, cURL, ArchiveBox and HTTPie. Wget alternatives are mainly Download Managers but may also be Website Downloaders or HTTP Clients.


1 Answers

I'm going to have to say curl http://127.0.0.1:8000 -o outfile

like image 73
SiegeX Avatar answered Oct 09 '22 23:10

SiegeX