CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  CMake 3.6.0 or higher is required.  You are running version 3.5.1
-- Configuring incomplete, errors occurred!

I know Ubuntu uses stable releases that it can support, but some repos require later versions of cmake. I want to overwrite the old cmake with the later version of cmake, but the common PPA doesn't carry the cmake I need. How can I upgrade cmake to use the needed version without conflicts with the older version?


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

  • 8
    Don't think you need to uninstall the old cmake because /usr/local/bin is ahead of /usr/bin in PATH. So once you make the symlink in your last step, the cmake command will call your new cmake instead of the old one. – edwinksl Sep 25 '16 at 6:15
  • 14
    As observed by Matt, IF YOU ARE A ROS USER DO NOT RUN "REMOVE CMAKE" Running this command will remove the current cmake version but will also remove parts of your ROS distribution, breaking everything and forcing you to re-install EVERYTHING related to ROS. A warning should be added to this command, or at the very least the leading answer should include a way to update cmake, rather than remove-and-replace. – sempaiscuba Jul 28 '17 at 0:18
  • 14
    ROS... "Robot Operating System"? – user1122069 Dec 4 '17 at 1:38
  • 10
    As of cmake 3.10.2 the installer no longer seems to install to /opt by default but rather to the current directory, so step 6 needs to be amended accordingly by the user. – JorgeGT Feb 14 '18 at 15:15
  • 5
    i did all that but once i type cmake --version it says command Cmake not found :( – DINA TAKLIT Oct 5 '18 at 12:09

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:

sudo make install
  • I like this solution because it is arguably the purest way to solve the problem. (Just build the software.) No mucking around with PPAs or anything. Thanks! – Max von Hippel Jun 1 '20 at 4:09
  • This is a self-consistent solution. It works for me. – Yuanhui Jan 20 at 8:55

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
  • 3
    I tried this and it updated from 2.x to 3.2.2, but my build script still says "CMake 3.5.1 or higher is required." Is it possible to specify the add-apt-repository to be an even later version than 3.x, say something like "3.5.x" ? – Timothy Swan Dec 25 '17 at 20:09
  • Tis limited to version 3.5.2-2 while current distributes support 3.10.2 – Salem F Feb 26 '20 at 14:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.