This question already has an answer here:

I'm on Ubuntu 16.04. I installed cmake with the command

sudo apt install cmake

It installed cmake 3.5.1. Now I want to use cmake 3.7 - I downloaded an archive with binaries (i.e cmake-3.7.0-Linux-x86_64.tar.gz) and extracted it, but how do I run it using the cmake command? My current attempt to run

cmake --version

returns the "old" 3.5.1 version.

marked as duplicate by mikewhatever, David Foerster, Eric Carvalho, TheWanderer, WinEunuuchs2Unix Nov 20 '16 at 1:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Which version you downloaded? source or binary? – SuB Nov 18 '16 at 22:03
  • @SuB Binary version. – nikitablack Nov 18 '16 at 23:38
  • @DavidFoerster: That problem cause is unavailability of cmake's server, but here is installing an version of cmake that does not exist in Ubuntu Repositoroes. – SuB Nov 19 '16 at 15:33
  • @SuB: Let's continue this discussion in chat. – David Foerster Nov 19 '16 at 16:01
up vote 6 down vote accepted

Remove old version using:

apt-get purge cmake

You can use new version of cmake by adding its bin directory path to $PATH. An alternative solution is to extract tar.gz package and go to the directory made after extracting and run following commands:

cp -r bin /usr/
cp -r doc /usr/share/
cp -r man /usr/share/
cp -r share /usr/

The second method is the same as installation process which .deb package does!

  • With the difference that you can remove a deb package easily. How do you plan to remove this when not needed? – muru Nov 19 '16 at 13:46
  • I agree - how to remove it if we just copied folders? – nikitablack Nov 19 '16 at 15:07
  • @muru: It is drawback of installing a package using this method. Compiling from source code has the same problem in some packages! In this case this package could be removed by deleting any file which is copied. Another solution is to make a .deb package and installing it. – SuB Nov 19 '16 at 15:45
  • There is a package for cmake 3.7 here in Ubuntu repository for zesty version, but i recommend you not using this package. Installing this package need to force dpkg to ignore package version check and may cause broken package database. – SuB Nov 19 '16 at 16:28

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