How to Fix: cmake command not found Error

2 min

Here’s how you can fix the “cmake command not found” error in Debian, Ubuntu, Fedora and Arch Linux.

CMake is a free and open-source set of tools and packages which helps to compile, build, test applications. It uses compiler independent configuration files to which controls software compilation process using the current platform. Its very handy tool to easily build any applications from source.

However, cmake is not always available in your Linux distributions. You need to install it. If you try to compile any source code without cmake, you should get this following error:

bash: cmake: command not found

Method 1: Installing cmake

The easiest way to fix this error is to install cmake from the command line. To install it, use the following commands from the terminal.

For Debian, Ubuntu, Linux Mint and related distributins:

sudo apt install cmake

For Fedora Linux, CentOS, RHEL:

sudo dnf install cmake

For Arch Linux:

sudo pacman -S --needed cmake

After you install cmake, try to re-run the command which caused the error in the first place.

cmake command not found error in Debian
cmake command not found error in Debian

Method 2: Compiling cmake

In a dire situation where if you need to compile cmake to install, the use the below instructions.

Install the build dependencies packages which is required to compile cmake.

sudo apt install build-essential libssl-dev

Download Cmake from GitHub. Choose the latest source code version for Linux 64-bit with tar.gz extension.

Extract the file using tar command or any other utility. A sample command is below, change the version name.

tar cmake-3.25.2.tar.gz

Go to the extracted folder and follow the pre-supplied bootstrap script to compile and install cmake. USe the following set of commands in sequence.

botostrap script to install cmake
botostrap script to install cmake
sudo make install

After installation, you can verify with --version switch whether it is installed.

cmake --version

Finally, you can try to compile your original source code of the app which caused this error.


I hope this guide solves the cmake not found error. Usually the method 1 of installing cmake should work for most of the cases. If you ran into any other error, let me know in the comment box below.


Creator and author of Connect with me via Telegram, 𝕏 (Twitter), or send us an email.
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments