Linux: CMake Command Not Found / Linux / CentOS / Linux: CMake Command Not Found

CMake is a set of cross-platform tools for building programs from source code on different compilers and operating systems. It doesn’t directly build, but only generates a Makefile, which will then be executed by the make command.

If the cmake utility is not installed on Linux, then when you run the compile command, you will receive an error:

cmake: command not found

Try to manually run the cmake command with an absolute path:

/usr/bin/cmake --version

Make sure the path to the directory with the cmake command is set in the $PATH environment variable:

echo $PATH

If necessary, add the path to $PATH.

Let’s take a look at how to install the CMake command on different Linux distros.

To install CMake on Ubuntu and Debian (and other DEB systems), run:

sudo apt-get update
sudo apt-get install cmake

Alternatively, you can install the build-essential meta-package, which includes a complete set of compilation tools, including cmake:

sudo apt-get install build-essential

On RPM distros (CentOS/RHEL/Debian) you can install cmake using the package manager:

dnf install cmake

You can also download and install the latest cmake from the source files on any Linux distribution:


Extract the archive:

tar -zxvf cmake-3.22.1-linux-x86_64.tar.gz

Go to the folder:

cd cmake-3.22.1-linux-x86_64

And run the commands:


installing cmake tool from source on linux

Build cmake:

make install

Make sure cmake is successfully installed on your host by displaying its version:

cmake --version
The make command is also used to compile and install programs from the source. If it is not installed, an error make command not found will appear.
Leave a Reply

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