Make Command Not Found on Linux

PowerADM.com / Linux / CentOS / Make Command Not Found on Linux

The make tool in Linux is used to build and compile programs from source files. The utility takes instructions for compilation from the makefile. In some Linux distributions, the make command is not installed by default (for example, in Linux CentOS 8), so when you run the build command, you will see an error:

bash: make: command not found

bash: make: command not found

Or:

bash: /usr/bin/make: No such file or directory

The Ubuntu console will display a message:

The program 'make' is currently not installed. You can install it by typing:
sudo apt install make

How to Fix the ‘Make: Command Not Found’ in Linux?

First of all, make sure that the make command is installed on your Linux distribution and that the path to its directory is included in the PATH environment variable. In most cases, the make file should be located in /usr/bin or /usr/local/bin.  Check if these directories contain an executable make binary:

$ ls /usr/bin/make

If you find a make executable in this directory, check to see if you can run it using an absolute path:

$ /usr/bin/make –version
GNU Make 3.82
Built for x86_64-redhat-linux-gnu

check make binary in /usr/bin linux

Check that the make directory path is in the PATH environment variable:

$ which make
$ echo "$PATH"
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

check make path in linux

In this example, the /usr/bin path is included in the PATH environment variable. To add a new directory to PATH, use the command:

$ export PATH=$PATH:/path_to/dir

Edit the ~/.bashrc file to make this change permanent for the current user:

$ nano ~/.bashrc

Add a line to the end of file:

export PATH=$PATH:/path_to/dir

How to Install Make on Different Operating Systems?

If you really do not have this utility on your computer, here is how to install the make command on various versions of Linux.

On rpm-based Linux distribution ( Fedora, Oracle/Rocky Linux, CentOS, Fedora, and RHEL), you can install the make tool using the command:

# yum install make

or

# dnf install make

install make command on linux

 

Or as part of the Development tools package group (requires about 500 MB of disk space).

# dnf groupinstall "Development tools" 

(on RHEL/CentOS 8)

or

# yum groupinstall "Development tools" 

(in previous RPM versions of Linux distros)

If make is already installed but doesn’t work, you can reinstall it:

# yum reinstall make

On deb-based distros such as Ubuntu, Debian, Raspbian, Kali Linux, you can install the make package using the command:

# apt-get install make

The make command is also contained in the build-essential metapackage. To install it run:

# apt-get install build-essential

To reinstall the make command, run:

# apt-get install --reinstall make

Or:

# sudo dpkg-reconfigure make

or:

# apt-get remove make
# apt-get install make

On Arch-based distributions (Arch Linux, Manjaro), the make utility can be installed  as follows:

$ sudo pacman –Syu
$ sudo pacman -S make

Or together with the base-devel package:

$ sudo pacman -Sy base-devel

To automatically install the make command and development tools in a Docker container, you can add the following directive to the docker file:

RUN apt-get install -y build-essential

On Windows, you can install the make command using the Chocolatey package manager. Install choco (if not already installed):

PS> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

You can then install the make package on Windows:

PS>  choco install make
The CMake command is also used to build from source in Linux. If it is not installed, an error cmake command not found will appear.
Leave a Reply

Your email address will not be published. Required fields are marked *