One of the easiest ways to download content from the internet to your Mac or Windows PC is to use a web browser. Or, if you want more control over your downloads, use a dedicated download manager that gets you a few extra features.

using Wget on Mac and Windows

With both of them, you essential get a GUI-based app that you need to launch every time you wish to download a file online. Plus, they generally require good download speeds to work well.

But what if your connection is slow, or you want to download files quickly and unattended?

Wget is the answer to these (and several other) questions. It’s basically a computer program with the ability to retrieve files from web servers over HTTP, HTTPS, and FTP protocols, all while being quick and easy to use.

Let’s dive in to check out Wget and how you can use it on your Mac or Windows PC to download files over the internet.

What Is Wget?

Wget, also called GNU Wget, is a CLI-based program for retrieving content from web servers. It derives from an old program, Geturl, which translates to ‘get content from URL‘ (Uniform Resource Locator), wherein get (or GET) is an HTTP method for fetching information from a website.

Wget supports downloading via HTTP, HTTPS, and FTP protocols and provides features such as recursive downloads, downloading through proxies, SSL/TLS support for encrypted downloads, and the ability to download paused/incomplete files.

Why Would You Want to Use Wget?

Before we jump in and describe Wget’s features and use-cases, it’s important to clarify that Wget isn’t a direct replacement for a web browser. Instead, it’s kind of like an add-on tool for your Mac and Windows PC that you can use to download files quickly from web pages to your device.

In addition to facilitating quick downloads, Wget also lets you:

  • Resume aborted/interrupted downloads on your Mac
  • Download files in the background unattended
  • Extract resources from web pages (just like a web crawler)
  • Download files recursively
  • Download content through proxies
  • Save websites’ content in the WARC (Web ARChive) format
  • Download files on a slow internet connection

How to Install Wget on Mac and Windows

Wget is easy to install on Mac and Windows. Follow the instructions in the sections below—depending on your operating system—to install it on your computer.

Steps to Install Wget on Mac

If you have a Mac, all you need for installing Wget on your machine is Homebrew. Homebrew is a free and open-source package manager that comes pre-installed on macOS. So unless you’ve deleted it, it should be present on your system.

Although, before proceeding with the Wget installation, you do need to update all the formulae and upgrade outdated packages in Homebrew. To do this, open the Terminal app and run the following command:

brew update && brew upgrade

Once updated, you can install Wget on your Mac using:

brew install wget

As the installation progresses, you’ll see the progress in the Terminal window. Please sit back and wait for it to complete.

Steps to Install Wget on Windows

On Windows, Wget installation requires you to download the program file and move it to the System32 directory—to ensure you can invoke Wget from any directory in the file system.

First, open the link below in your web browser and download the latest version of Wget for Windows on your computer.

Download: Wget for Windows

Go to your Downloads folder and copy the wget.exe file to C:/Windows/System32. When prompted to confirm access, hit Continue to finish copying the file.

Finally, verify if Wget is installed by opening the Command Prompt and running:

wget

How to Use Wget

Wget might seem a bit intimidating at first. But once you get hold of its syntax and options, it isn’t that complicated.

Wget Syntax

Generally speaking, Wget commands use the following syntax:

wget [option] [url]

…where

  • option specifies the action to be performed on the supplied URL
  • url is the web address from where you want to download content

From here on out, you just got to follow this syntax and add options to your commands based on the operation you want to perform. The following are some of the most common Wget operations.

1. Download a File

To download a single file from a URL, open the Terminal or Command Prompt and run your command in the following syntax:

wget url/of/the/file

Eg:

wget https://example.com/filename.txt

Wget will now resolve the supplied domain, connect to the server, and begin downloading. Wget will show you details like file size, transfer speeds, download progress, and estimated time to complete the download when the download starts.

Once the file is downloaded, you can find it in your current working directory, i.e., from the directory where you ran the Wget command.

To identify your present working directory, run pwd in the Terminal or CMD. This will return your current path in the file system. Copy it and enter it in the File Explorer (on Windows) or Finder (on macOS) to get there.

2. Download a File to a Specific Directory

As we mentioned, Wget saves your downloads to the current working directory by default.

However, if you’d like to save it to some other directory, you can do so in one of the two ways. For the first method, change your present working directory to the directory where you’d like to save the file you’re about to download using the ls (on macOS)/dir (on Windows) and cd commands in the CMD or Terminal. Once inside the directory, run the Wget command to download the file.

On the other hand, you can avoid having to run these commands beforehand by explicitly mentioning the path of the directory where you want to save your file in the Wget download command with the -p (prefix) option, as shown below:

wget -P absolute/path/to/directory/ url/of/the/file

3. Download and Save a File Under a Different Name

When you download a file via Wget, it saves the file with the name with which it’s named on the server. But if you want, you can save it under a different name using the -O option.

Here’s what that command would look like:

wget -O file_name_with_extension url/of/the/file

Eg:

wget -O phone.jpg https://example.com/image.jpg

4. Download Multiple Files

Sometimes you may want to download multiple files—from one or more websites—at once. With Wget, it’s easier to do this.

Simply create a text (.txt) file on your Mac or Windows and add links to the files you want to download. You can do this by right-clicking on a file and selecting Copy link address from the menu.

Once you’ve added these links to the text file, open the CMD or Terminal and navigate to the directory where you want to save these files. Once inside, enter a command in the following syntax:

wget -i file_name.txt

Eg:

wget -i downloads.txt

5. Download a File by Skipping Certificate Check

An SSL certificate authenticates a website’s identity and enables an encrypted connection. It’s present on pretty much most websites these days. However, there may be times when you’d want to download a file from a website that doesn’t have a valid SSL certificate.

Using the standard Wget download wouldn’t help in this case. Instead, you’ll need to use the –no-check-certificate option to bypass SSL check.

Adding this to your command would look like this:

wget --no-check-certificate url/of/the/website

Eg:

wget --no-check-certificate http://example.com

6. Resume an Incomplete Download Wget

Wget makes it quite easy to resume a download that was interrupted. So, if you tried downloading a file in a browser (like Chrome), and it stopped downloading midway for some reason, you can resume the download where it left off using Wget.

To do this, open the Terminal or CMD and use the -c option in your command, as shown in the following syntax:

wget -c url/of/the/file

Eg:

wget https://example.com/file.txt

7. Mirror a Website

If you wish to create a mirror of a website (or save an entire website) to your desktop, you can do so using the -m option, as shown in the command below:

wget -m url/of/the/website

Eg:

wget -m https://example.com

All of this website’s resources, such as HTML, CSS, JS, and media, will now be saved to a directory with the website name under your current working directory.

8. Download a File via FTP

Wget also supports downloading via FTP. To download a file via FTP, you need the username and password for the server. After which, you can simply specify the same in the following command syntax to download it:

wget --ftp-user=ftp_username --ftp-password=ftp-password ftp://url/of/the/website

Eg:

wget --ftp-user=admin --ftp-password=pass@1234 ftp://ftp.example.com/file.pdf

9. Limit Download Speed

If, for some reason, you don’t want Wget to take up your entire bandwidth—perhaps because you have other downloads in progress or because it may slow down your browsing experience—you can limit Wget’s downloading speed using the –limit-rate option:

wget --limit-rate 20k url/of/the/file

Eg:

wget --limit-rate 20k https://example.com/file.txt

10. Set a Timeout in Wget

All the Wget operations we’ve discussed so far assume a working server at the other end of the connection. But as you can imagine, there may be times when a server (you’re trying to download files from) may not work properly.

In this, due to the way Wget is developed, it will keep trying to connect to the server until it downloads the requested file. However, you can prevent Wget from doing so by using the -T option followed by time (in seconds), like this:

wget -T 10 url/of/the/file

Eg:

wget -T 10 https://cd.example.com/image.jpg

Similarly, you can also limit the number of tries. For this, use the –tries option:

wget --tries=2 url/of/the/file

Wget Help

At any point, if you need help with any Wget command or want to know what options it offers, run:

wget -h

What Else Can You Do With Wget?

Wget’s use-cases extend far beyond the operations we’ve covered in this guide. However, the ones on the list should give you a solid understanding of Wget’s workings and some level of familiarity with its usage (and available options) to suffice most of your download needs.

Over time, should you wish to explore more use-cases of Wget, you can check out Wget’s man page to learn about them.

Was this article helpful?
YesNo