Zsh is a widely used command line shell that offers powerful features and extensive customization options; however, the users may experience some errors while running the commands on the terminal. The zsh command not found wget error is one of those errors that are usually encountered by Mac users. This error occurs when Zsh cannot locate the wget command in its set of available commands.
In this article, we will explore the fixes to solve this type of error on the Mac terminal.
How to Fix – zsh: command not found: wget Error
The zsh: command not found: wget error is a message that appears when you attempt to run the wget command in the Zsh shell but encounter a problem. It suggests that Zsh cannot find the wget command among its recognized commands, resulting in the error message. The primary cause for this error to occur is since wget utility might not be installed on your system, preventing Zsh from recognizing the command.
To fix the zsh: command not found: wget error in the Mac terminal, you can follow the steps below:
Step 1: Check wget Installation on Zsh
First, ensure wget is properly installed on your Mac and this can be done by running the wget version as shown below:
The output suggests that wget is not installed on your system, and you can proceed to Step 2 to perform the installation.
Step 2: Install wget on Zsh
To install wget on Zsh using Homebrew, execute the following command:
This command will install wget on your system, allowing Zsh to recognize the wget command.
Note: To get the installation guide of Homebrew on Mac visit here.
Step 3: Test the Installation
Finally, test if the wget command is recognized by Zsh by running the following command:
Optional Steps
Sometimes, the case may occur that after installing the wget, the problem will still be there. To fix this issue, you have to perform some additional steps given below:
Step 4: Add the Path Variable
The path variable informs Zsh where to find the wget executable file. To add the correct path for the wget destination, open the .zshrc file and append the following line to specify the path for the wget location:
Note: You can find the wget path directory on Zsh from the following command:
Step 5: Save the Changes
Then save the path variable file using CTRL+X, add Y and press enter, and then reload the file to apply the changes.
Once you have completed the above steps, you can test the wget command in your Zsh terminal:
Conclusion
Encountering the zsh: command not found wget error can be frustrating when you are trying to use wget in your Zsh terminal. By following the steps outlined in this article, including checking the installation of wget, installing wget on Zsh using Homebrew, adding the correct path variable for wget, saving the changes, and verifying the command, you can resolve this error and ensure seamless usage of wget in Zsh.