If you see “wget: command not found” in your terminal, the program is simply not installed on your system or not in your PATH. The fix is to install it with your package manager, or use an alternative like curl if you cannot install it. This article explains why the error appears, how to install wget on the most common operating systems, and what to do when installation is not an option.
What Is Wget and Why Do You Need It?
Wget is a free command-line utility for downloading files from the web. It supports HTTP, HTTPS, and FTP protocols, and it is especially useful for downloading entire websites recursively, resuming interrupted downloads, and downloading files in the background. It has been a standard tool on Unix-like systems for decades, but it is not included by default on every operating system. Many minimal Linux installations, macOS (which ships with curl instead), and Windows (unless you use a Unix-like environment) do not have wget preinstalled.
Why Does the Error Appear?
The error “wget: command not found” means the shell cannot locate an executable named wget in any of the directories listed in your PATH environment variable. This can happen for several reasons:
- Wget is not installed at all.
- Wget is installed but not in the default PATH (e.g., installed in a custom directory).
- You are using a minimal container or a stripped-down system where wget is intentionally omitted.
- You are on macOS, which only includes
curlby default.
To confirm whether wget is installed but not in PATH, you can try which wget or type wget. If those return nothing, it is not installed.
How to Install Wget on Linux
Linux distributions use different package managers. The command you need depends on your distribution. Here are the most common ones:
- Debian/Ubuntu:
sudo apt update && sudo apt install wget - Fedora/RHEL/CentOS:
sudo dnf install wget(older versions useyum) - Arch Linux:
sudo pacman -S wget - openSUSE:
sudo zypper install wget - Alpine Linux:
apk add wget(no sudo needed if you are root)
After installation, verify with wget --version. If you still get “command not found,” log out and back in, or run hash -r to refresh the shell’s command cache.
How to Install Wget on macOS
macOS does not include wget by default, but you can install it easily using Homebrew, the most popular package manager for macOS. If you do not have Homebrew, install it first from brew.sh, then run:
brew install wget
If you prefer not to use Homebrew, you can compile wget from source, but that requires Xcode command-line tools and is more involved. Alternatively, you can use curl, which is preinstalled on macOS and can handle most downloads: curl -O URL saves the file with its original name.
How to Install Wget on Windows
Windows does not have a native wget command, but there are several ways to get it:
- Windows 10/11 with WSL: Install Windows Subsystem for Linux and then use the Linux package manager (e.g.,
sudo apt install wget). - Git Bash: If you have Git for Windows, it includes a version of wget in its
usr/binfolder. You can runwgetinside Git Bash. - Chocolatey: Run
choco install wgetin an elevated PowerShell. - Direct download: Download a standalone wget.exe from a trusted source and place it in a folder that is in your PATH.
Note that Windows PowerShell has an alias wget that points to Invoke-WebRequest, but its syntax is different. If you type wget in PowerShell, you might see a different error. Use curl.exe (the real curl) in PowerShell for a more familiar experience.
What If You Cannot Install Wget?
Sometimes you are on a shared server or a restricted environment where you cannot install new packages. In that case, use curl, which is almost always present. The most common curl equivalents are:
- Download a file:
curl -O https://example.com/file.zip - Download with a different name:
curl -o myfile.zip https://example.com/file.zip - Resume an interrupted download:
curl -C - -O https://example.com/file.zip - Follow redirects:
curl -L -O https://example.com/download
For recursive downloads (like mirroring a website), curl is not as convenient as wget. In that case, consider using a tool like wget2 (if available) or a graphical download manager.
Common Problems and Troubleshooting
Even after installing wget, you might encounter issues. Here are a few common ones:
- “wget: command not found” after installation: This usually means the shell’s PATH is not updated. Try
hash -ror restart the terminal. - SSL certificate errors: If you get “ERROR: cannot verify certificate,” you can add
--no-check-certificateto bypass the check, but only do this for trusted sites. - Permission denied: If you cannot write to the current directory, use
sudoor change to a writable directory like/tmp. - wget is not recognized in Windows PowerShell: As mentioned, PowerShell’s
wgetis an alias. Usewget.exeorcurl.exeinstead.
Frequently Asked Questions
Is wget better than curl?
It depends on the task. Wget is simpler for basic downloads and supports recursive mirroring out of the box. Curl is more versatile for sending data, handling APIs, and supporting many protocols. For most single-file downloads, either works.
How do I check if wget is installed?
Run wget --version in your terminal. If it shows version information, it is installed. If you get “command not found,” it is not.
Why is wget not included in macOS by default?
Apple chose to include curl instead, likely because curl is more feature-rich for API interactions and is licensed under a permissive license. Wget is GNU-licensed, which may have influenced the decision.
Can I use wget on Android?
Yes, if you install a terminal emulator and a package manager like Termux, you can run pkg install wget to get it.
What does “wget: command not found” mean in a Docker container?
It means the base image you are using does not include wget. You can install it during the build with RUN apt-get update && apt-get install -y wget (for Debian-based images) or use curl if it is available.
Is there a way to use wget without installing it?
You can use a web-based wget service, but that is not recommended for sensitive files. A better option is to use curl or download the file via a browser.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Upscaling Gimmick? Why Better Displays Change Everything
- OnePlus 5T 8GB RAM: Was It Really Launched?
- Remote Work Security: Stay Safe Outside the Office
- Starlink Satellite Texting: First Nationwide Service?
- Uninstall Skype for Business: Full Removal Guide
- Export iCloud Contacts to CSV: Full Guide