make: command not found Error in Ubuntu
To solve the “make: command not found” error in Ubuntu, you need to install the make
utility which is a powerful command line tool for automating building software from source code.
Since Ubuntu does not include the make
tool by default, getting the make: command not found error after running the make
command indicates that the make utility is not installed on your system.
Steps to install make command in Ubuntu to fix make command error
The make
command is a useful build automation tool that is used for compiling and building software from source code. If you want to benefit from high-performance Ubuntu VPS for developing and building software, running the make command can significantly simplify the process of building and managing software projects.
Therefore, resolve the “make: command not found” error by installing the make
command in Ubuntu:
1. Update package lists:
Login to your Ubuntu VPS as a sudo-enabled user, launch the terminal by pressing CTRL + ALT + T simultaneously, and update the package lists using the following command to prepare your Ubuntu system for installing make package:
sudo apt update
2. Install the make command in Ubuntu:
Install the make
command in Ubuntu using the apt
package manager:
sudo apt install make
Or
sudo apt-get install make
3. Verify the make Installation:
To verify that make
has been installed properly, run the following command:
make --version
If this command outputs the make
version which means the make tool is installed successfully on your Ubuntu system.
Additional Considerations:
If your tasks are tied up with compiler software and developer tools, it is recommended to install the build-essential package which includes the ‘make’ tool and other essential tools (such as GNU Compiler Collection (GCC), g++, and other compilers ) instead of installing ‘ make
‘ individually without other build tools. To do this, run the following command:
sudo apt install build-essential
Therefore, you have installed all necessary dependencies and additional libraries or tools to ‘ make
‘ function correctly.
After installing make tool successfully, you should not encounter “make: command not found” error.
What if make installation does not fix the error
Persisting the make
error after its successful installation is a very rare case, however, if even make is installed and it does not work again or is not found, look for the cause in Path issues. Maybe the $PATH environment variable does not include make
command and causes this error.
Solution1: Reinstall make in Ubuntu
To solve “make: command not found” error, reinstall make
with this command:
sudo apt install --reinstall make
If reinstalling the make command cannot solve the make: command not found error, manually adjusting your path environment variable is the solution. However, generally this manual effort after a fresh installation is not necessary.
Solution 2: Adjust the PATH Environment Variable in Ubuntu
When you run the command, your system searches for executable files using the PATH environment variable (a list of directories). Usually, the PATH must include the /usr/bin which is a directory containing the make tool by default. Therefore, first check your current PATH using the following command:
echo $PATH
If the /usr/bin (directory containing make) is not listed in the output of this command, you must manually add the/usr/bin directory to the PATH variable in Ubuntu.
Identify the shell you are using (e.g., bash, zsh) with the following command:
echo $SHELL
Open shell-specific configuration file for example .bashrc file for Bash shell using your preferred text editor:
nano ~/.bashrc
Note: For the Zsh shell you must edit .zshrc file.
Type following line in the end of the file to add the/usr/bin directory to PATH:
export PATH="$PATH:/usr/bin"
Save and Close the file.
To apply the changes run the following command:
source ~/.bashrc
Modifying the system-wide PATH is dangerous and it is not recommended generally, but if you are very experienced you can do it and successfully add make to your PATH and fix the “make command not found” error in Ubuntu.
Solution3: Locate make binary and ensure to add the correct path
If you still have a problem with make in Ubuntu, double-check the directory where make is installed and make sure to add the correct path to your configuration file. Locate the make
binary using the following commands:
which make
This command usually returns the /usr/bin/make as the path where make is installed. If it returns another directory for example “/etc/” directory, it means make
binary has been placed in the wrong directory and you have added the wrong path to your configuration file.
In this case, you must move make
binary from the /etc directory to the correct directory (/usr/bin directory) using the following command:
sudo mv /etc/make /usr/bin
Modifying files in /usr/bin can have consequences like instability and conflicts with package management due to the possibility of overwriting important files. Do these steps with caution and if necessary, follow these steps with sufficient expertise.
In general, installing the make command will fix the “make: command not found” error. These steps are for exceptional situations.
If your problem is not fixed yet, which is impossible, check your internet connection and package manager configuration.
By following these solutions you should be able to solve the “make: command not found” error in Ubuntu.
Conclusion
make: command not found error in Ubuntu usually occurs when your Ubuntu system is not equipped with the make tool. To overcome this error in Ubuntu, there are efficient solutions including installing the make tool in Ubuntu, adding make binary to the PATH variable, installing necessary dependencies and additional tools, and ensuring adding the correct path to your configuration file which we have provided a comprehensive guide in this regard.