How to Fix “make: command not found” Error in Ubuntu

Configurare noua (How To)

Situatie

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.

 

Solutie

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

Installing make with the apt command

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

Installing the build-essential package with the apt command

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.

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

Running the make command to see what response we get

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

Using the whereis command to look for make

If you see a message from Bash saying it can’t find the make command, then make isn’t installed.

Trying the make command without it installed results in an error with suggestions.

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

Applying updates with the apt command

We can install make easily with this command.

sudo apt install make

Installing make with the apt command

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

Installing the build-essential package with the apt command

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.

 

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

Moving the make file to its correct directory

Now if we try to use the make command, any messages we get should come from make, and not from Bash.

make

The default response from make

Great, we’ve got make working on this computer. You will no longer see the “make: command not found” error.

Tip solutie

Permanent

Voteaza

(4 din 9 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?