The issue of ‘CMake not found yet it is installed’ is a common headache for developers. Despite having CMake installed, the system often fails to recognize it, leading to the frustrating “command not found” error. This problem typically arises due to misconfigured environment variables or incorrect installation paths, causing significant delays and annoyance in the development process.
Here are the potential reasons for encountering the ‘cmake not found yet it is installed’ error:
Incorrect Installation Paths:
Missing Environment Variables:
System Path Issues:
Permission Issues:
Corrupted Installation:
Conflicting Versions:
Check Installation Directory:
/usr/local/bin
on Unix-like systems or C:\Program Files\CMake\bin
on Windows.Run Version Check:
cmake --version
. This command should display the installed version of CMake.Verify PATH Configuration:
~/.bashrc
, ~/.zshrc
, or equivalent:export PATH="/path/to/cmake/bin:$PATH"
Reinstall or Update CMake:
These steps should help resolve the ‘cmake not found’ error despite having it installed.
Check CMake Installation:
cmake --version
If not installed, install it:
sudo apt install cmake # Ubuntu/Debian
sudo yum install cmake # CentOS/RHEL
sudo dnf install cmake # Fedora
Find CMake Binary Location:
which cmake
Note the path (e.g., /usr/bin/cmake
).
Add CMake to PATH:
sudo nano ~/.bashrc
Add the following line at the end:
export PATH="/usr/bin:$PATH" # Replace /usr/bin with your CMake path
Reload .bashrc:
source ~/.bashrc
Verify:
cmake --version
This should resolve the ‘cmake not found’ error.
Here’s a step-by-step guide to reinstall CMake and resolve the ‘cmake not found yet it is installed’ issue:
Remove Existing CMake Installation:
sudo apt remove --purge cmake
sudo apt autoremove
brew uninstall cmake
Delete Residual Files:
sudo rm -rf /usr/local/bin/cmake /usr/local/share/cmake*
sudo rm -rf /usr/local/bin/cmake /usr/local/share/cmake*
C:\Program Files\CMake
.Reinstall CMake:
sudo apt update
sudo apt install cmake
brew install cmake
Verify Installation:
cmake --version
Add CMake to PATH (if necessary):
echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
This should resolve the issue and ensure CMake is properly installed and recognized by your system.
Follow these steps:
apt remove
for Linux, brew uninstall
for macOS, or Control Panel for Windows./usr/local/bin/cmake
and /usr/local/share/cmake*
directories on Linux and macOS, or manually delete remaining files from C:\ extbackslash{}Program Files\ extbackslash{}CMake
on Windows.apt install
for Linux, brew install
for macOS, or download the installer from the official website for Windows.cmake --version
.export PATH=/usr/local/bin:$PATH
to ~/.bashrc
and source it on Linux and macOS, or add the CMake bin directory to system PATH via Environment Variables settings on Windows.This should resolve the issue and ensure CMake is properly installed and recognized by your system.