How to install the latest version of Cmake via command line.

Build, Test, and package your software with Cmake !
CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice.

Well, we can install it by following these simple steps:

  1. Uninstall the default version provided by Ubuntu’s package manager:
    sudo apt-get purge cmake
  2. Go to the official CMake webpage, then download and extract the latest version. Update the version and build variables in the following command to get the desired version:
    mkdir ~/temp
    cd ~/temp
    tar -xzvf cmake-$version.$build.tar.gz
    cd cmake-$version.$build/
  3. Install the extracted source by running:
    make -j4
    sudo make install
  4. Test your new cmake version.
    $ cmake --version

    Results of cmake --version:

    cmake version 3.10.X


In 3.10.X the X represents the last part of the version that we defined as build. The build may change if cmake is updated. Just for example given below:-


That’s it.