OS X: equivalent of Linux's wget
Categories:
Mastering Downloads on macOS: The curl
Command and Alternatives

Explore the macOS equivalents to Linux's wget
command, focusing on the powerful curl
utility and other convenient download methods.
Linux users often rely on wget
for command-line file downloads. When transitioning to macOS, a common question arises: what's the equivalent? While wget
isn't pre-installed on macOS, the operating system provides an even more versatile and powerful tool: curl
. This article will guide you through using curl
for various download scenarios and introduce other methods to achieve similar results on your Mac.
Introducing curl
: The macOS Download Workhorse
curl
is a command-line tool and library for transferring data with URLs. It supports a wide range of protocols, including HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP, LDAPS, FILE, POP3, POP3S, IMAP, IMAPS, SMTP, SMTPS, RTMP and RTSP. Unlike wget
, which primarily focuses on HTTP/FTP downloads and recursive retrieval, curl
is designed for more general data transfer, making it incredibly flexible for both downloading and uploading. It's pre-installed on macOS, making it the go-to utility for command-line transfers.
curl -O https://example.com/path/to/file.zip
Downloading a file and saving it with its original filename.
curl -o custom_name.zip https://example.com/path/to/file.zip
Downloading a file and saving it with a custom filename.
-L
flag to follow redirects and the -C -
flag to resume interrupted downloads: curl -L -C - -O URL
.Advanced curl
Usage and Common Scenarios
curl
can handle much more than simple file downloads. You can use it to fetch web page content, send POST requests, manage cookies, and even simulate browser behavior. Understanding these options unlocks its full potential for web development, scripting, and automation tasks.
curl https://www.example.com > homepage.html
Fetching the content of a web page and saving it to a file.
curl -X POST -d "param1=value1¶m2=value2" https://api.example.com/submit
Sending a POST request with form data.
flowchart TD A[Start Download] --> B{URL Provided?} B -- Yes --> C{Output File Specified?} C -- Yes (-o) --> D[Save as Custom Name] C -- No (-O) --> E[Save as Original Name] B -- No --> F[Error: No URL] D --> G[Download Complete] E --> G F --> G
Basic curl
download logic for file saving.
Installing wget
on macOS (Optional)
While curl
is highly capable, some users might prefer the familiarity of wget
or need it for scripts originally written for Linux environments. You can easily install wget
on macOS using Homebrew, the popular package manager for macOS. This process is straightforward and provides access to the exact wget
utility you're used to.
1. Install Homebrew (if not already installed)
Open your Terminal application and run the following command to install Homebrew. Follow the on-screen instructions, which may include installing Xcode Command Line Tools.
2. Install wget
using Homebrew
Once Homebrew is installed, you can install wget
with a simple command in your Terminal.
3. Verify Installation
After installation, you can check if wget
is correctly installed and accessible by running the version command.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Command to install Homebrew.
brew install wget
Command to install wget
via Homebrew.
wget --version
Verifying wget
installation.
wget
is available, curl
is generally preferred on macOS due to its native integration and broader feature set for data transfer.