How to reinstall the latest cmake version?

Posted on Mar 22, 2022

Question

I would like to install cmake the latest version, on Linux environment. I have cmake version 3.5 installed and is not supported by some applications. I tried to upgrade it by uninstalling the current version. But when I reinstall with sudo apt-get install cmake, I get the same version 3.5 re-installed. How do I install the latest version with sudo apt-get install ....?

Answer

As far as I know the best way to get the latest CMake version installed on any Linux is not by apt but using pip.

Remove the apt cmake and install the latest version from pip which can easily keep up-to-date.

apt remove cmake -y
pip install cmake --upgrade