Skip to content
Home » wget on macOS: How to Install It (and the curl Equivalents)

wget on macOS: How to Install It (and the curl Equivalents)

Dark terminal card headed curl stops at the redirect, showing the same URL fetched twice with curl and the http_code write-out option: without -L it returns 301, and with -L it returns 200, plus labels reading macOS ships no wget and wget follows redirects while curl needs -L

Paste a wget command from a README into the Terminal on a Mac and it fails before it starts: zsh: command not found: wget. macOS has never shipped it. What it does ship is curl, which covers most of what people use wget for — with one default that behaves differently and quietly breaks half the commands you copy.

Confirm it is missing, not broken

Before blaming your PATH, check whether the file exists at all. macOS keeps its command-line tools in a handful of directories, and wget is in none of them:

$ ls /usr/bin/wget /bin/wget
ls: /bin/wget: No such file or directory
ls: /usr/bin/wget: No such file or directory

That is the difference between “not installed” and “installed but not found”. If a command really is on the disk and the shell cannot see it, a different set of checks applies. Here there is nothing to find, and it has nothing to do with your setup — wget is GPL-licensed software that Apple does not include, the same reason tree is not there either.

What you do have is curl, in the base system, no install required:

$ curl --version
curl 8.7.1 (x86_64-apple-darwin25.0) libcurl/8.7.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.68.1

The one default that catches everyone

Here is the difference that matters more than any flag translation table. wget follows HTTP redirects by default. curl does not. A redirect is not an error, so curl reports success, writes the redirect page instead of your file, and exits 0.

$ curl -s -o /dev/null -w "%{http_code}\n" http://osxhub.com/
301
$ curl -sL -o /dev/null -w "%{http_code}\n" http://osxhub.com/
200

Same URL, two results. Without -L curl stops at the 301 and hands you a few hundred bytes of redirect notice; with it, curl follows through to the 200 and the actual content. Any modern site does this — plain http to https, bare domain to www, a download link to a mirror — so a wget command translated flag-for-flag without adding -L will often appear to work and produce a useless file.

The habit worth forming: put -L on every curl command that downloads something. It costs nothing when there is no redirect.

What makes this failure mode so easy to miss is that nothing looks wrong. There is no error, the exit status is 0, and a file appears with the name you expected. Only its contents are wrong — a short HTML page saying the resource moved, sitting where you expected an archive. If a downloaded file turns out to be far smaller than advertised, or an unzip fails with a complaint about the format, check the first few lines before assuming the server is at fault:

head -3 the-file-you-just-downloaded

HTML at the top of something that should be a tarball is the redirect page, and adding -L fixes it.

Translating wget commands to curl

The second thing to know is that a bare curl URL does not save a file at all — it prints the response to your terminal, which for anything binary means a screen of noise. Two flags control the destination:

curl -LO https://example.com/archive.tar.gz     # save as archive.tar.gz
curl -Lo mine.tar.gz https://example.com/archive.tar.gz

Capital -O keeps the name from the URL, which is what wget does automatically. Lowercase -o takes a name you supply. Getting these two the wrong way round is the second most common mistake after the redirect, and the failure is quiet: -o with no filename argument swallows the next thing on the line.

The rest of the everyday flags map cleanly:

wgetcurlWhat it does
wget URLcurl -LO URLDownload, keep the remote filename
wget -O name URLcurl -Lo name URLDownload under a chosen name
wget -c URLcurl -LC - -O URLResume an interrupted download
wget -q URLcurl -sLO URLQuiet, but still report errors with -S
wget --header="X: y"curl -H "X: y"Send a request header
wget --post-data=…curl -d …Send a POST body
wget --spidercurl -sLI -o /dev/null -w "%{http_code}\n"Check a URL without downloading

The -C - form for resuming is worth reading carefully: the argument to -C is a byte offset, and the bare - tells curl to work it out from the existing file. Leave the dash off and curl waits for a number that never comes.

Two smaller habits from the table. -s alone silences errors as well as the progress meter, so -sS is the pair you want in a script: quiet when it works, loud when it does not. And %{http_code} in -w is the cheapest way to check a URL from a script — no parsing, just the status code on its own line.

Where the output goes

The other assumption wget users bring with them is that a download command writes a file. With curl, the default destination is your terminal:

$ curl -s https://osxhub.com/robots.txt
# START YOAST BLOCK
# ---------------------------
User-agent: *

For a text file that is genuinely useful — it is why curl … | sh installers work at all, and why curl is the natural tool for poking at an API. For a binary it fills the screen with control characters and can leave the terminal in a strange state, which is what the reset command is for.

This default is also why the progress meter behaves the way it does. curl prints progress to standard error while content goes to standard output, so piping into another command still shows you the meter. Add -s to silence it, and remember from the table above that -s hides errors too — -sS keeps the errors and drops the noise.

What curl will not do

One category has no translation. wget -r walks a site, follows the links it finds, and writes out a directory tree — mirroring. curl fetches the URLs you give it and does not parse HTML for more, so there is no flag that turns it into a crawler. wget --mirror, -np, -k for rewriting links, and the retry-until-it-works behaviour of --tries are all in the same category.

If that is what you came for, stop translating and install the real thing. That is a design difference, not a gap curl intends to close: curl is a transfer tool for individual URLs, and the two programs have never tried to be the same shape.

Installing the real thing

With Homebrew it is one line:

brew install wget

After that wget works exactly as the documentation you were reading says, because it is the same program. Worth being deliberate about the choice, though. If you are following one README, translating the command is faster than adding a package manager and its update obligations to a machine. If you mirror sites, or you maintain scripts shared with Linux machines where rewriting every wget call is not an option, install it and stop thinking about it.

One thing that will not happen: a Homebrew wget does not replace or interfere with the system curl. They are separate binaries in separate directories, and nothing about installing one changes the other.

Quick reference

SituationCommand
Download a file, keep its namecurl -LO URL
Download under a different namecurl -Lo name URL
Resume a partial downloadcurl -LC - -O URL
Quiet, but still show errorscurl -sSLO URL
Just the status codecurl -sLI -o /dev/null -w "%{http_code}\n" URL
Mirror a whole sitebrew install wget, then wget -r

The short version: curl -LO is the everyday replacement, the -L is the part people leave off, and mirroring is the one job worth installing wget for.

Leave a Reply

Your email address will not be published. Required fields are marked *