How to fix the “wget command not found” error {update 2023}

Wget package is not installed in your system that’s the major reason why you face the “wget command not found” error. In this post, I will not only show you the different commands to install wget in your system, but I will also provide you Panacea for all your wget problems.

What is Wget?

Wget is free software or utility to download files from the internet and support HTTP, HTTPS, FTP and FTPS protocols. It is a non-interactive command line tool, so widely used in cron jobs, scripts and playbooks.

These are the common errors you generally find related to wget in your Linux, Windows or mac systems.

  • wget command not found mac
  • wget command not found windows
  • bash: wget command not found centos
  • wget issue in Jenkins
  • wget command not found linux
  • wget command not found Debian
  • git bash: wget command not found
  • wget command not found in jupyter
  • wget command not found Cygwin
  • Command ‘wget’ not found, but can be installed with:
wget command not found

Universal solution to fix the “wget command not found” error

The solution is only one to all above-mentioned wget errors, Just install wget in your Linux, macOS or Windows system. If you are trying to use wget in ansible playbooks, Jenkins or docker files, don’t forget to provide the command to install wget first before using it for downloading any software, Files or package in your codes.

How to install the wget package to solve “wget command not found errors

If you are working with the wget command on a terminal and you are getting the wget command not found error, the first step is to check, whether the wget is installed or not, Then accordingly you can choose the solution or installation method based on your operating system.

How to check the wget version in any Linux or macOS

To check the wget version –

  • Open terminal in your Linux or macOS
  • Run command wget -V as shown in the image.
$ wget -V
check installation of wget

If you get the version and details of the wget package as shown in the above image, it means the wget package is installed in your system. In case you got the wget command not found error, then continue reading this post. Look for the solution based on your operating system.

How to install the wget command in Ubuntu or Debian-based operating system

If you are using Ubuntu or any other Debian-based operating system like LinuxMint, Kubuntu, Lubuntu etc, then the following command will help you to install the wget utility in your system.

$ sudo apt update

$ sudo apt install wget
How to fix wget command not found error in Linux

How to install wget in RPM-based Linux distributions like CentOS/RedHat/Rocky Linux/AlmaLinux/Fedora

To install the wget package in RedHat or RPM based linux systems, use the yum command –

$ sudo yum install wget

or

$ dnf install wget

Steps to fix wget command not found error in macOS

To fix the wget command not found errors in macOS, you can use the brew package manager. It can easily install any package in your macOS.

$ brew install wget

In case you got the error zsh command not found: brew, It means brew is not installed in your system follow this command to install brew in your system.

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

How to fix wget command not found error in Windows

You have two options to use the wget utility in Windows if you are getting ‘wget’ is not recognized as an internal or external command,
operable program or batch file
error.

wget not found error windows
  1. Install WSL (Windows Subsystem for Linux) in Windows, Install and use the wget utility as shown in the post (Linux section)
  2. Download the latest wget exe file and use it

Let’s talk about both methods one by one.

  • WSL method – WSL (Windows Subsystem for Linux) is available in Windows, in case you want to use or develop any Linux functionality without installing Linux OS in dual boot with your Windows. You can leverage the WSL feature, For details, check out my post on how to install wsl1 and wsl2. Once you enable wsl and installed Linux, you can follow the Linux section in this post to learn how to install wget.
  • wget.exe method – You can also use wget directly by downloading (32bit version from GNUwin32) and running the setup to install wget and dependent DLLs/libraries etc.

Below mentioned are the steps to install wget in Windows –

  • Once the download is complete, then double click on wget-1-11.4-1.setup.exe
Download wget and start installation
  • Click “Next" on the welcome wizard
  • Accept EULA
Accept EULa
  • Keep selecting Next until you reach the location page
  • Select the destination location for installation, I will keep it default.
Setup Destination location for wget installation in Windows
  • Keep accepting default options and “Next” in the wizard and finally choose to Install to being installing wget on your Windows as shown in the image.
Fix wget command not found error in windows via wget installation
  • Hit Finish once you are done with installation.
  • Setup path variable for wget utility. First Open system environment variable > Edit Path variable > Add New > Add “C:\Program Files (x86)\GNUWin32\bin\ (provide your wget 32-bit Installation path) and hit Ok thrice to close the dialogue box.
setup Path after wget installation
  • Open the command prompt and run
  • wget -V to check the version or wget -h to see the help.
check wget version

Frequently Asked Questions – Wget

How to install wget using an ansible playbook?

Following code may be helpful if you are looking for ansible code to install wget –

* For Debian-based distributions like Ubuntu, Kubuntu, Lubuntu and Linux mint –

- name: Install wget package (Debian based)

action: apt pkg='wget' state=installed

only_if: "'$ansible_pkg_mgr' == 'apt'"

* For RedHat-based Operating system

- name: Install wget package (RedHat based)

action: yum name='wget' state=installed

only_if: "'$ansible_pkg_mgr' == 'yum'"

Why is wget in Jenkins not working?

In case wget is working fine from the terminal in your linux system, but you are getting the “wget command not found” in Jenkins, then You may need to configure environment variables for master in $JENKINS_URL/configure or for a slave in $JENKINS_URL/computer/SLAVENAME/configure.

Don’t forget to check the box “Environment variables” and fill in key-value pairs.

How to install Install wget using rpm?

Although you can install wget and its dependent libraries in RPM-based distributions using the yum or dnf command as recommended. But for the legacy operating systems, if you are looking for rpm methods, follow these steps to install wget using rpm –

1. Download the wget package from rpmfind.net
2. Copy it to your Linux system, open Terminal
3. run the
following command using root or sudo user

$ sudp rpm -ivh "absolute path of rpm package"

or

# rpm -ivh "absolute path of rpm package"

How to install wget in dockerfile or container image?

If you are looking to install wget in dockerfile or container image, the following code may help you. You can change version 22.04 as per your requirement.

FROM ubuntu:22.04
RUN apt-get update \
&& apt-get install -y wget \
&& rm -rf /var/lib/apt/lists/*

How to Install wget on Alpine?

apk is the command used to install any package in the alpine. So you can simply replace apt or apt-get commands with apk or apk add respectively. Following is an example to install wget in Alpine.

$ RUN apk add --no-cache wget

End Note

I hope you would have solved your issue of “wget command not found” via this article. wget and curl are really very useful command line tools to use scripts and codes. To know more about how to use wget, you can simply run the man wget command or wget -h command on the terminal. You can check out this link also for further wget documentation.

Useful troubleshooting links

Dev

I'm Dev, your friendly neighbourhood Tech Savy. I spend my days with gadgets, servers, and the occasional laugh-inducing software mishap. Think of me as your tech-savvy, glitch-prone buddy. If you've got questions, feedback, or just need someone to blame when your Wi-Fi goes haywire, I'm your guy!