In bioinformatics, cmake is used to install multiple software including GROMACS, jdock, and so on. Here is a short tutorial on how to upgrade cmake on Ubuntu and get rid of the previous version.
Update and upgrade your system first.
$ sudo apt-get update
$ sudo apt-get upgrade
Now check what version you have
$ cmake --version
Currently, I have 3.16. We will remove this version and then install the latest one.
Now remove this version using the following command:
$ sudo apt remove cmake -y
Let’s install the latest version.
$ pip3 install cmake --upgrade
Now check
$ cmake --version
It should display the latest version.
However, if you still see the previous version or get any error such as “could not find cmake_root !!!” like this:
CMake Error: Could not find CMAKE_ROOT !!! CMake has most likely not been installed correctly. Modules directory not found in /home/user/.local/share/cmake-3.16 cmake version 3.16.3
In this case, clear the cache.
$ hash -r
Now check the version again, it should work.
$ cmake --version