To fix the “make: command not found” error on Ubuntu Linux, you will need to install make. To install make, run the “sudo apt install make” command or, to install the standard development tools at the same time, use the “sudo apt install build-essential” command.
Standard Ubuntu installs don’t include the Linux make
utility. It’s used mainly by software developers, but even non-coders may need it in some situations. Here’s how to install make
on Ubuntu Linux.
What “make: command not found” Means
If you’re seeing the “make: command not found” error on Ubuntu (or another Linux distribution), that means the make
command isn’t currently installed on your system. That’s normal—Ubuntu doesn’t install the make
command by default.
The make
utility is often used when compiling software from source code on Linux. Whether you’re trying to run the make
command directly yourself or you’re using a piece of software that is calling make
in the background, you will see the “make: command not found” error saying it’s not installed.
To fix the “make: command not found” error, you just need to install make
. You can do that with apt
, Ubuntu’s standard package manager.
How to Fix “make: command not found” on Ubuntu
To fix “make: command not found” on Ubuntu, you will need to install the make
utility.
To install just the make
utility, run the following command in a Terminal:
sudo apt install make
We recommend installing the build-essential package, which also includes make
as well as other critical packages for building software. Run the following command in a terminal to install it:
sudo apt install build-essential
After installing make
, you will no longer see the “make: command not found” error. You can run a make
command directly from the command line or launch an installation script that depends on make
once again to continue.
What Is the make Utility?
The make
tool is a command-line utility that assists in building software projects. To appreciate its usefulness, though, you have to understand how software is normally developed. When programmers write code they type their program instructions into an editor or an integrated development environment. Something has to happen to convert the text files into an executable binary. That step is called compilation, and it requires a program called a compiler.
The compiler reads the source code files, and translates them into low-level instructions that the CPU can understand. It generates a binary file containing all of those instructions. It’s the binary file that gets called and executed when you try to run your program.
Compilers are complicated pieces of software. They have a great many command line options that can be invoked, for each file that they need to compile. And a complicated development project can have hundreds of different source code files. That’s a lot of settings to have to keep track of. Another complication is you don’t want to compile files that haven’t changed since they were last compiled. That’s a waste of time.
A makefile is a simple text file that holds all the settings and rules required for the development project to be built into an executable binary file. It also avoids the recompilation of files that haven’t changed since the previous compile. The program that reads the makefile and coordinates the building of the project is make
.
The controlled recompilation and build of the project can be carried out by issuing one command: make
. Some integrated development environments use auto-generated makefiles and carry out the compile phase by calling make
in the background.
I’m Not a Programmer, Why Should I Care?
Its primary user base might be programmers, but there may still be reasons why you might need make
installed on your computer, even if you never write a line of code.
Some software packages don’t get wrapped into installation files. To obtain a working version of the program you either have to download an archive file containing all the source code, or you need to clone the program’s Git repository to obtain the source code, and then run make
.
If you use VirtualBox to run other Linux distributions as virtual machines, you’ll know that for the best experience you need to install the VirtualBox Guest Additions inside the guest operating system. To do this, the VirtualBox Guest Additions kernel modules must be built, and to accomplish that, make
must be present on the guest operating system.
How to Install make With apt
If you’re working with a new installation of Ubuntu, it won’t have make
on it. If you’re administering a computer for someone else, it’s worth checking to see whether make
is already installed.
Type the make command and hit “Enter.”
make
If you see a message from make
complaining that you didn’t give it a specific command and it couldn’t find a makefile, then make
is installed and working. You can use the whereis
command to see where the make
binary and man
pages are located.
whereis make
If you see a message from Bash saying it can’t find the make
command, then make
isn’t installed.
If you haven’t applied any updates for a while, it’ll be worth running the apt
command with the update
option, first.
sudo apt update
We can install make
easily with this command.
sudo apt install make
However, without the default set of development tools make
isn’t much use. So you might as well install them. Handily, these are bundled into a single package called “build-essential.” Installing that package installs tools like gcc
and g++
, and it also installs make
.
I usually skip the step of installing make
on its own, and move straight to installing the “build-essential” package. It kills two birds with one stone.
Install the “build-essential” package with this command.
sudo apt install build-essential
There’s a lot of tools in “build-essential”, and it takes a few minutes to install them all. It’s worth the small wait though, as they’ll stand you in good stead. You ought to be able to cope with all kinds of software builds now.
RELATED: apt vs. apt-get: What’s the Difference on Linux?
What If Bash Still Can’t Find make?
Very rarely, make
is installed but Bash still can’t find it. To solve this, we might as well try the easy option first. You can force a reinstall of make
using this command.
sudo apt install --reinstall make
If that doesn’t work, you can use the find
command to try to locate the make
binary. Then we can make sure it is in a directory that is in the $PATH
environment variable.
This command will search your file system from the root directory, looking for a file called “make.” It pipes the output into less
.
find / -type f -name "make" | less
Once the search is complete, search for the word “make” in less
by pressing the forward slash ” /
“, typing “make” and pressing “Enter.” You’ll see all the lines that contain the word “make.”
As you can see, the find
command has found three files that Bash uses as part of its “Tab” command-line completions, and the binary executable. But something has gone very wrong with this installation, and the make
binary has been placed in the “/etc/” directory.
We’ll move that to where it should be, and make
should start to work.
sudo mv /etc/make /usr/bin
Now if we try to use the make
command, any messages we get should come from make
, and not from Bash.
make
Great, we’ve got make working on this computer. You will no longer see the “make: command not found” error.
If You Can make It Here
You can make it anywhere.
These techniques should work on other distributions, too. You’ll just need to substitute the installation commands for the ones used in your own distribution.
On Fedora you can use this command to install the build tools, along with make
.
sudo dnf groupinstall "Development Tools" "Development Libraries"
On Manjaro, use this command.
sudo pacman -S base-devel
RELATED: How to Install Linux Software in Windows 10’s Ubuntu Bash Shell