How to upgrade cmake in Ubuntu

Warning -- Do not do step 2 if you have Robot Operating System (ROS) installed

  1. Check your current version with cmake --version
  2. Uninstall it with sudo apt remove cmake
  3. Visit https://cmake.org/download/ and download the latest binaries
    • In my case cmake-3.6.2-Linux-x86_64.sh is sufficient copy the binary to /opt/
  4. chmod +x /opt/cmake-3.*your_version*.sh (chmod makes the script executable)
  5. sudo bash /opt/cmake-3.*your_version.sh* (you'll need to press y twice)

    The script installs to /opt/cmake-3.*your_version* so in order to get the cmake command, make a symbolic link:

  6. sudo ln -s /opt/cmake-3.*your_version*/bin/* /usr/local/bin

    Test your results with cmake --version


In the new version of cmake (ex: 3.9.6), to install, download tar file from https://cmake.org/download/. Extract the downloaded tar file and then:

cd $CMAKE_DOWNLOAD_PATH
./configure
make
sudo make install

I would like to follow your advice Wolf, but the script don't install the prog. So i just creat the folder but doesn't show like installed when i do

 cmake --version 

I find a other way peraps more easy :

sudo -E add-apt-repository -y ppa:george-edison55/cmake-3.x
sudo -E apt-get update
sudo apt-get install cmake

Tags:

Cmake