In many quides from the Internet, it is recommended that you use the ifconfig command to configure the network or view information about it. This is a very old, but convenient utility that has a simple syntax and displays information in a simple and correct way.
But when you try to use this command, you can sometimes get the error: “ifconfig command not found” or “ls command not found”. Everything is clear here, the command was not found, but these are quite popular utilities, and it is strange that it is not supplied by default. In this article we will consider what to do if you encounter such an error and why this happens.
Table of Contents
Terminal Error: Command Not Found
The first reason you can get this error is very simple. Most likely, the utility is installed on your system, but the bash interpreter cannot find it. The fact is that on Unix-like systems there are several folders for storing executable files. All utilities that only the superuser can execute are located in the /sbin or /usr/sbin directory.
Accordingly, the ordinary user does not need to give access to these files, therefore these directories are accessible only by root, and they are not even added to the PATH environment variable from which bash takes directories to search for programs for the user. Simply, all you have to do is run the program on behalf of the superuser:
Sudo Doesn’t Help
If even after that you get this error, it means that the program is still not installed. The fact is that the utility is quite old, and some developers thought that it was necessary to develop something more advanced, so the “ip” utility was developed. It has more features and is better, because in the next updates, developers could decide that ifconfig is no longer needed as well as telnet.
Thus, to fix the error: “command not found” you need to install a package with it. If you still don’t have the Homebrew package manager, then it’s time to get one. Using Homebrew reinstall the desired package.
Install Telnet on Mac via Homebrew
You must first install the missing Homebrew package manager. What does Homebrew do? Homebrew installs the packages you need that are not provided by Apple. Use this step-by-step guide for the fastest solution:
- Install Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- In this article you can find the easiest way to install any packages to your macOS via Homebrew.
After the installation of the package is completed, and it will be done very quickly, you can use the utility and there will be no more command not found errors. Just run it with “sudo”.
In this article, we looked at what to do if you encounter the bash error “command not found”, and also why it arises. This is one of the simplest mistakes, it is very easy to fix it. I hope this information was useful to you.