How do I install the latest version of cmake from the command line?











up vote
59
down vote

favorite
17












I am trying to install latest cmake in my linux box and I am always getting the below exception -



userName@phx5qa01c-4e23:~/build$ wget http://www.cmake.org/files/v2.8/cmake-2.8.11.tar.gz
--2013-10-08 14:39:55-- http://www.cmake.org/files/v2.8/cmake-2.8.11.tar.gz
Resolving www.cmake.org... 66.194.253.19
Connecting to www.cmake.org|66.194.253.19|:80... failed: Connection timed out.
Retrying.

--2013-10-08 14:40:17-- (try: 2) http://www.cmake.org/files/v2.8/cmake-2.8.11.tar.gz
Connecting to www.cmake.org|66.194.253.19|:80... failed: Connection timed out.
Retrying.

--2013-10-08 14:40:40-- (try: 3) http://www.cmake.org/files/v2.8/cmake-2.8.11.tar.gz
Connecting to www.cmake.org|66.194.253.19|:80...


It is always retrying... Any thoughts?



Does anyone know what wrong I am doing here? Or is there any better way of installing latest version of cmake in my linux box?



userName@phx5qa01c-4e23:~/build$ uname -a
Linux phx5qa01c-4e23 2.6.35-22-server #33-Ubuntu SMP Sun Sep 19 20:48:58 UTC 2010 x86_64 GNU/Linux









share|improve this question
























  • Are you sure there isn't a firewall blocking your connection? Why using wget? Try to download that file (cmake.org/files/v2.8/cmake-2.8.11.tar.gz) using a web browser.
    – Eric Carvalho
    Oct 8 '13 at 22:54










  • Similar question here: askubuntu.com/questions/610291/… with a good answer.
    – Eliptical view
    Oct 24 '16 at 22:19












  • I think your question is "How to install latest cmake version in Linux" but the command sudo apt-get install cmake does not install the latest version.
    – Teocci
    Aug 17 '17 at 1:54










  • askubuntu.com/a/952929/579410
    – KindDragon
    Jul 19 at 13:55















up vote
59
down vote

favorite
17












I am trying to install latest cmake in my linux box and I am always getting the below exception -



userName@phx5qa01c-4e23:~/build$ wget http://www.cmake.org/files/v2.8/cmake-2.8.11.tar.gz
--2013-10-08 14:39:55-- http://www.cmake.org/files/v2.8/cmake-2.8.11.tar.gz
Resolving www.cmake.org... 66.194.253.19
Connecting to www.cmake.org|66.194.253.19|:80... failed: Connection timed out.
Retrying.

--2013-10-08 14:40:17-- (try: 2) http://www.cmake.org/files/v2.8/cmake-2.8.11.tar.gz
Connecting to www.cmake.org|66.194.253.19|:80... failed: Connection timed out.
Retrying.

--2013-10-08 14:40:40-- (try: 3) http://www.cmake.org/files/v2.8/cmake-2.8.11.tar.gz
Connecting to www.cmake.org|66.194.253.19|:80...


It is always retrying... Any thoughts?



Does anyone know what wrong I am doing here? Or is there any better way of installing latest version of cmake in my linux box?



userName@phx5qa01c-4e23:~/build$ uname -a
Linux phx5qa01c-4e23 2.6.35-22-server #33-Ubuntu SMP Sun Sep 19 20:48:58 UTC 2010 x86_64 GNU/Linux









share|improve this question
























  • Are you sure there isn't a firewall blocking your connection? Why using wget? Try to download that file (cmake.org/files/v2.8/cmake-2.8.11.tar.gz) using a web browser.
    – Eric Carvalho
    Oct 8 '13 at 22:54










  • Similar question here: askubuntu.com/questions/610291/… with a good answer.
    – Eliptical view
    Oct 24 '16 at 22:19












  • I think your question is "How to install latest cmake version in Linux" but the command sudo apt-get install cmake does not install the latest version.
    – Teocci
    Aug 17 '17 at 1:54










  • askubuntu.com/a/952929/579410
    – KindDragon
    Jul 19 at 13:55













up vote
59
down vote

favorite
17









up vote
59
down vote

favorite
17






17





I am trying to install latest cmake in my linux box and I am always getting the below exception -



userName@phx5qa01c-4e23:~/build$ wget http://www.cmake.org/files/v2.8/cmake-2.8.11.tar.gz
--2013-10-08 14:39:55-- http://www.cmake.org/files/v2.8/cmake-2.8.11.tar.gz
Resolving www.cmake.org... 66.194.253.19
Connecting to www.cmake.org|66.194.253.19|:80... failed: Connection timed out.
Retrying.

--2013-10-08 14:40:17-- (try: 2) http://www.cmake.org/files/v2.8/cmake-2.8.11.tar.gz
Connecting to www.cmake.org|66.194.253.19|:80... failed: Connection timed out.
Retrying.

--2013-10-08 14:40:40-- (try: 3) http://www.cmake.org/files/v2.8/cmake-2.8.11.tar.gz
Connecting to www.cmake.org|66.194.253.19|:80...


It is always retrying... Any thoughts?



Does anyone know what wrong I am doing here? Or is there any better way of installing latest version of cmake in my linux box?



userName@phx5qa01c-4e23:~/build$ uname -a
Linux phx5qa01c-4e23 2.6.35-22-server #33-Ubuntu SMP Sun Sep 19 20:48:58 UTC 2010 x86_64 GNU/Linux









share|improve this question















I am trying to install latest cmake in my linux box and I am always getting the below exception -



userName@phx5qa01c-4e23:~/build$ wget http://www.cmake.org/files/v2.8/cmake-2.8.11.tar.gz
--2013-10-08 14:39:55-- http://www.cmake.org/files/v2.8/cmake-2.8.11.tar.gz
Resolving www.cmake.org... 66.194.253.19
Connecting to www.cmake.org|66.194.253.19|:80... failed: Connection timed out.
Retrying.

--2013-10-08 14:40:17-- (try: 2) http://www.cmake.org/files/v2.8/cmake-2.8.11.tar.gz
Connecting to www.cmake.org|66.194.253.19|:80... failed: Connection timed out.
Retrying.

--2013-10-08 14:40:40-- (try: 3) http://www.cmake.org/files/v2.8/cmake-2.8.11.tar.gz
Connecting to www.cmake.org|66.194.253.19|:80...


It is always retrying... Any thoughts?



Does anyone know what wrong I am doing here? Or is there any better way of installing latest version of cmake in my linux box?



userName@phx5qa01c-4e23:~/build$ uname -a
Linux phx5qa01c-4e23 2.6.35-22-server #33-Ubuntu SMP Sun Sep 19 20:48:58 UTC 2010 x86_64 GNU/Linux






command-line software-installation cmake






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '17 at 7:28









muru

135k19289489




135k19289489










asked Oct 8 '13 at 21:47









SSH

4511712




4511712












  • Are you sure there isn't a firewall blocking your connection? Why using wget? Try to download that file (cmake.org/files/v2.8/cmake-2.8.11.tar.gz) using a web browser.
    – Eric Carvalho
    Oct 8 '13 at 22:54










  • Similar question here: askubuntu.com/questions/610291/… with a good answer.
    – Eliptical view
    Oct 24 '16 at 22:19












  • I think your question is "How to install latest cmake version in Linux" but the command sudo apt-get install cmake does not install the latest version.
    – Teocci
    Aug 17 '17 at 1:54










  • askubuntu.com/a/952929/579410
    – KindDragon
    Jul 19 at 13:55


















  • Are you sure there isn't a firewall blocking your connection? Why using wget? Try to download that file (cmake.org/files/v2.8/cmake-2.8.11.tar.gz) using a web browser.
    – Eric Carvalho
    Oct 8 '13 at 22:54










  • Similar question here: askubuntu.com/questions/610291/… with a good answer.
    – Eliptical view
    Oct 24 '16 at 22:19












  • I think your question is "How to install latest cmake version in Linux" but the command sudo apt-get install cmake does not install the latest version.
    – Teocci
    Aug 17 '17 at 1:54










  • askubuntu.com/a/952929/579410
    – KindDragon
    Jul 19 at 13:55
















Are you sure there isn't a firewall blocking your connection? Why using wget? Try to download that file (cmake.org/files/v2.8/cmake-2.8.11.tar.gz) using a web browser.
– Eric Carvalho
Oct 8 '13 at 22:54




Are you sure there isn't a firewall blocking your connection? Why using wget? Try to download that file (cmake.org/files/v2.8/cmake-2.8.11.tar.gz) using a web browser.
– Eric Carvalho
Oct 8 '13 at 22:54












Similar question here: askubuntu.com/questions/610291/… with a good answer.
– Eliptical view
Oct 24 '16 at 22:19






Similar question here: askubuntu.com/questions/610291/… with a good answer.
– Eliptical view
Oct 24 '16 at 22:19














I think your question is "How to install latest cmake version in Linux" but the command sudo apt-get install cmake does not install the latest version.
– Teocci
Aug 17 '17 at 1:54




I think your question is "How to install latest cmake version in Linux" but the command sudo apt-get install cmake does not install the latest version.
– Teocci
Aug 17 '17 at 1:54












askubuntu.com/a/952929/579410
– KindDragon
Jul 19 at 13:55




askubuntu.com/a/952929/579410
– KindDragon
Jul 19 at 13:55










9 Answers
9






active

oldest

votes

















up vote
16
down vote



accepted










Probably the server at www.cmake.org was just very busy. You could try again or download the file using your web browser.



There is however a much simpler way:



sudo apt-get install cmake


Update: commenters point out that "Ubuntu 12.04 is only shipping v2.8.7" and "14.04 is still shipping 2.8". That is for a reason: 12.04 and 14.04 are LTS releases of Ubuntu. LTS releases are intended to remain stable for 5 years, so they receive only security and critical updates, not the latest releases of packages. Normal releases come out every 6 months, and are therefore more likely to come with a recent cmake.






share|improve this answer



















  • 2




    ubuntu 12.04 is only shipping v 2.8.7 of cmake with apt-get. The current release of version 2 is 2.8.12. I suggest you persevere with building it from source.
    – Richard Hodges
    Jun 16 '14 at 17:23






  • 32




    This is not the correct answer. The latest version is almost never on apt.
    – Senjai
    Feb 20 '15 at 6:09






  • 2




    14.04 still shipping 2.8
    – Stolas
    Mar 17 '16 at 9:22






  • 2




    This answer is wrong. The StableReleaseUpdates policy is not just for LTS releases. All Ubuntu releases, once actually released, only get fixes for security vulnerabilities or otherwise serious bugs. As shown here (and on Launchpad), even non-LTS releases haven't received new cmake versions. Separate backports for some packages do exist (but not cmake).
    – Eliah Kagan
    Aug 4 '17 at 11:56






  • 6




    This answer is wrong because sudo apt-get install cmake does not, by itself, ever upgrade cmake to a newer version. This does not work on any Ubuntu release. If your answer is actually "upgrade your Ubuntu system to a newer release" then you may want to edit again to make that clearer. (That would not be a reasonable solution for many users, though, and often there is no released version of Ubuntu whose repositories have the latest version of cmake.)
    – Eliah Kagan
    Aug 23 '17 at 13:55




















up vote
100
down vote













The most common situation is when you want to install the latest version of cmake, but your Operating System's repositories are not updated. For example, in my case I have a laptop running Ubuntu 16.04, and when I executed the command sudo apt install cmake the installed version was 3.5.1; instead of, 3.13.0 which is the current version at cmake.org.



How can I get the latest version?



Well, we can install it by following one of this methods:



A. Building and Installing (recommended)



A-1. Uninstall the default version provided by Ubuntu's package manager:



sudo apt remove cmake
sudo apt purge --auto-remove cmake


A-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:



version=3.13
build=0
mkdir ~/temp
cd ~/temp
wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz
tar -xzvf cmake-$version.$build.tar.gz
cd cmake-$version.$build/


A-3. Install the extracted source by running:



./bootstrap
make -j4
sudo make install


A-4. Test your new cmake version.



$ cmake --version


Results of cmake --version:



cmake version 3.13.X

CMake suite maintained and supported by Kitware (kitware.com/cmake).


B. Using binary files (cmake-gui wont work well)



B-1. Uninstall the default version provided by Ubuntu's package manager as in A-1.



B-2. Go to the official CMake webpage, then download and install the latest .sh version in opt/cmake. Update the version and build variables in the following command to get the desired version:



version=3.13
build=0
mkdir ~/temp
cd ~/temp
wget https://cmake.org/files/v$version/cmake-$version.$build-Linux-x86_64.sh
sudo mkdir /opt/cmake
sudo sh cmake-$version.$build-Linux-x86_64.sh --prefix=/opt/cmake


B-3. Add the installed binary link to /usr/local/bin/cmake by running this:



sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake


B-4. Test your new cmake version as in A-4.



Note



In 3.13.X the X represents the last part of the version that we defined as build. The build may change if cmake is updated. According to the official webpage the Latest Release is 3.13.0. If you want the Previous Release 3.12.4 just replace the version and build parameters like this:



version=3.12
build=4





share|improve this answer



















  • 7




    The make install command need root privileges. The cmake --version command only works after open a new terminal because cmake is installed under /usr/local/bin/ by default, not /usr/bin/.
    – HD189733b
    Jan 22 '17 at 19:10










  • @Teocci, I have long tried to do this in various ways, and only your decision helped me. Thank you very much!!!)))))))
    – neo
    Mar 21 '17 at 13:49










  • I'm glad that this answer helped you. Happy coding and all the best.
    – Teocci
    Mar 22 '17 at 0:19






  • 2




    This is not a solution to UPDATE but to INSTALL cmake. Try this command or google it to find a solution: sudo apt-get remove cmake cmake-data
    – Teocci
    Dec 26 '17 at 2:18








  • 1




    Note to also build the cmake-gui tool, add --qt-gui to the bootstrap command.
    – Richard Whitehead
    Mar 12 at 16:53




















up vote
36
down vote













First uninstall any cmake package previously installed. Then:




  1. Go to http://www.cmake.org/download/ and download the latest .sh installer



  2. Install it (for example) in opt/cmake by running



    sudo mkdir /opt/cmake
    sudo sh <installer filename> --prefix=/opt/cmake


  3. Add the cmake bin directory to your path: https://askubuntu.com/a/170240/359343



Installed in this way, cmake-gui looks a little bit horrible, if you find a way to fix it please feel free to edit this answer.






share|improve this answer



















  • 4




    Add a link from /usr/local/bin/cmake to the installed binary. This way there is no need to change the PATH. sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
    – Christian
    Mar 16 '16 at 14:30






  • 2




    This is the best answer.
    – SuB
    Nov 20 '16 at 9:59






  • 2




    really, this is most useful answer for initial question
    – amigo421
    Dec 1 '16 at 19:37










  • This gives me broken cmake-gui, which doesn't work over xRDP (prev version worked), and xRDP is the only way to access the server.
    – stiv
    Mar 28 at 18:56










  • @stiv 1. Did you verify cmake after the installation is working, and that you have no other cmake version in your path? 2. Can you verify if you are using the cmake-gui provided in the installation, and not some older version? (To know the version, append --version to the command line)
    – Antonio
    Mar 29 at 16:22




















up vote
16
down vote













Just in case if someone need to install latest CMAKE in a docker image (like me..). In this case is 3.7.2, but you can check here https://cmake.org/download/ as already pointed out



#install latest cmake
ADD https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.sh /cmake-3.7.2-Linux-x86_64.sh
RUN mkdir /opt/cmake
RUN sh /cmake-3.7.2-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
RUN cmake --version





share|improve this answer





















  • Nice, undocumented --skip-license option :)
    – 4LegsDrivenCat
    Jun 15 '17 at 4:22


















up vote
4
down vote













You can also execute the following:



export fn=/tmp/cmake.sh && ls $fn && (echo "use previous $fn? Enter for yes, ctrl+d for no." && read) || (wget -O $fn http://www.cmake.org/files/v3.0/cmake-3.0.2-Linux-i386.sh 1>&2) && (cd /opt && sudo bash ${fn} && echo sudo ln -f -s /opt/cmake*/bin/cmake /usr/local/bin/cmake && cd -)


This script




  • fetches make 3.0.2
    ** if it was already downloaded in this session, then you might reuse it if you did not finish the installation

  • then it copies makes link to the bin cmake.






share|improve this answer




























    up vote
    4
    down vote













    I love the following way because you can get a recent version without much trouble.



    Kitware seems to officially support a pip wheels release. So you can get latest cmake just by doing:




    pip install --upgrade cmake




    Here is the blog about it:
    https://blog.kitware.com/cmake-python-wheels/






    share|improve this answer




























      up vote
      2
      down vote













      Remove old version using:



      apt-get purge cmake


      Download binary version of cmake archived in a tarball. 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!






      share|improve this answer




























        up vote
        0
        down vote













        For a Docker container, best run



        RUN wget -qO- "https://cmake.org/files/v3.12/cmake-3.12.1-Linux-x86_64.tar.gz" | 
        tar --strip-components=1 -xz -C /usr/local


        Adjust the version, if needed.






        share|improve this answer




























          up vote
          0
          down vote













          Install the latest version of cmake from backports, where many latest versions reside. The particular backports depends on your current OS version. For example, running Debian Stretch, add the following to /etc/apt/sources.list



          deb http://ftp.debian.org/debian stretch-backports main


          Then install from this backport, aka:



          sudo apt-get -t stretch-backports install -y cmake





          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f355565%2fhow-do-i-install-the-latest-version-of-cmake-from-the-command-line%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            9 Answers
            9






            active

            oldest

            votes








            9 Answers
            9






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            16
            down vote



            accepted










            Probably the server at www.cmake.org was just very busy. You could try again or download the file using your web browser.



            There is however a much simpler way:



            sudo apt-get install cmake


            Update: commenters point out that "Ubuntu 12.04 is only shipping v2.8.7" and "14.04 is still shipping 2.8". That is for a reason: 12.04 and 14.04 are LTS releases of Ubuntu. LTS releases are intended to remain stable for 5 years, so they receive only security and critical updates, not the latest releases of packages. Normal releases come out every 6 months, and are therefore more likely to come with a recent cmake.






            share|improve this answer



















            • 2




              ubuntu 12.04 is only shipping v 2.8.7 of cmake with apt-get. The current release of version 2 is 2.8.12. I suggest you persevere with building it from source.
              – Richard Hodges
              Jun 16 '14 at 17:23






            • 32




              This is not the correct answer. The latest version is almost never on apt.
              – Senjai
              Feb 20 '15 at 6:09






            • 2




              14.04 still shipping 2.8
              – Stolas
              Mar 17 '16 at 9:22






            • 2




              This answer is wrong. The StableReleaseUpdates policy is not just for LTS releases. All Ubuntu releases, once actually released, only get fixes for security vulnerabilities or otherwise serious bugs. As shown here (and on Launchpad), even non-LTS releases haven't received new cmake versions. Separate backports for some packages do exist (but not cmake).
              – Eliah Kagan
              Aug 4 '17 at 11:56






            • 6




              This answer is wrong because sudo apt-get install cmake does not, by itself, ever upgrade cmake to a newer version. This does not work on any Ubuntu release. If your answer is actually "upgrade your Ubuntu system to a newer release" then you may want to edit again to make that clearer. (That would not be a reasonable solution for many users, though, and often there is no released version of Ubuntu whose repositories have the latest version of cmake.)
              – Eliah Kagan
              Aug 23 '17 at 13:55

















            up vote
            16
            down vote



            accepted










            Probably the server at www.cmake.org was just very busy. You could try again or download the file using your web browser.



            There is however a much simpler way:



            sudo apt-get install cmake


            Update: commenters point out that "Ubuntu 12.04 is only shipping v2.8.7" and "14.04 is still shipping 2.8". That is for a reason: 12.04 and 14.04 are LTS releases of Ubuntu. LTS releases are intended to remain stable for 5 years, so they receive only security and critical updates, not the latest releases of packages. Normal releases come out every 6 months, and are therefore more likely to come with a recent cmake.






            share|improve this answer



















            • 2




              ubuntu 12.04 is only shipping v 2.8.7 of cmake with apt-get. The current release of version 2 is 2.8.12. I suggest you persevere with building it from source.
              – Richard Hodges
              Jun 16 '14 at 17:23






            • 32




              This is not the correct answer. The latest version is almost never on apt.
              – Senjai
              Feb 20 '15 at 6:09






            • 2




              14.04 still shipping 2.8
              – Stolas
              Mar 17 '16 at 9:22






            • 2




              This answer is wrong. The StableReleaseUpdates policy is not just for LTS releases. All Ubuntu releases, once actually released, only get fixes for security vulnerabilities or otherwise serious bugs. As shown here (and on Launchpad), even non-LTS releases haven't received new cmake versions. Separate backports for some packages do exist (but not cmake).
              – Eliah Kagan
              Aug 4 '17 at 11:56






            • 6




              This answer is wrong because sudo apt-get install cmake does not, by itself, ever upgrade cmake to a newer version. This does not work on any Ubuntu release. If your answer is actually "upgrade your Ubuntu system to a newer release" then you may want to edit again to make that clearer. (That would not be a reasonable solution for many users, though, and often there is no released version of Ubuntu whose repositories have the latest version of cmake.)
              – Eliah Kagan
              Aug 23 '17 at 13:55















            up vote
            16
            down vote



            accepted







            up vote
            16
            down vote



            accepted






            Probably the server at www.cmake.org was just very busy. You could try again or download the file using your web browser.



            There is however a much simpler way:



            sudo apt-get install cmake


            Update: commenters point out that "Ubuntu 12.04 is only shipping v2.8.7" and "14.04 is still shipping 2.8". That is for a reason: 12.04 and 14.04 are LTS releases of Ubuntu. LTS releases are intended to remain stable for 5 years, so they receive only security and critical updates, not the latest releases of packages. Normal releases come out every 6 months, and are therefore more likely to come with a recent cmake.






            share|improve this answer














            Probably the server at www.cmake.org was just very busy. You could try again or download the file using your web browser.



            There is however a much simpler way:



            sudo apt-get install cmake


            Update: commenters point out that "Ubuntu 12.04 is only shipping v2.8.7" and "14.04 is still shipping 2.8". That is for a reason: 12.04 and 14.04 are LTS releases of Ubuntu. LTS releases are intended to remain stable for 5 years, so they receive only security and critical updates, not the latest releases of packages. Normal releases come out every 6 months, and are therefore more likely to come with a recent cmake.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Aug 23 '17 at 10:49

























            answered Oct 8 '13 at 22:15









            zwets

            8,06122240




            8,06122240








            • 2




              ubuntu 12.04 is only shipping v 2.8.7 of cmake with apt-get. The current release of version 2 is 2.8.12. I suggest you persevere with building it from source.
              – Richard Hodges
              Jun 16 '14 at 17:23






            • 32




              This is not the correct answer. The latest version is almost never on apt.
              – Senjai
              Feb 20 '15 at 6:09






            • 2




              14.04 still shipping 2.8
              – Stolas
              Mar 17 '16 at 9:22






            • 2




              This answer is wrong. The StableReleaseUpdates policy is not just for LTS releases. All Ubuntu releases, once actually released, only get fixes for security vulnerabilities or otherwise serious bugs. As shown here (and on Launchpad), even non-LTS releases haven't received new cmake versions. Separate backports for some packages do exist (but not cmake).
              – Eliah Kagan
              Aug 4 '17 at 11:56






            • 6




              This answer is wrong because sudo apt-get install cmake does not, by itself, ever upgrade cmake to a newer version. This does not work on any Ubuntu release. If your answer is actually "upgrade your Ubuntu system to a newer release" then you may want to edit again to make that clearer. (That would not be a reasonable solution for many users, though, and often there is no released version of Ubuntu whose repositories have the latest version of cmake.)
              – Eliah Kagan
              Aug 23 '17 at 13:55
















            • 2




              ubuntu 12.04 is only shipping v 2.8.7 of cmake with apt-get. The current release of version 2 is 2.8.12. I suggest you persevere with building it from source.
              – Richard Hodges
              Jun 16 '14 at 17:23






            • 32




              This is not the correct answer. The latest version is almost never on apt.
              – Senjai
              Feb 20 '15 at 6:09






            • 2




              14.04 still shipping 2.8
              – Stolas
              Mar 17 '16 at 9:22






            • 2




              This answer is wrong. The StableReleaseUpdates policy is not just for LTS releases. All Ubuntu releases, once actually released, only get fixes for security vulnerabilities or otherwise serious bugs. As shown here (and on Launchpad), even non-LTS releases haven't received new cmake versions. Separate backports for some packages do exist (but not cmake).
              – Eliah Kagan
              Aug 4 '17 at 11:56






            • 6




              This answer is wrong because sudo apt-get install cmake does not, by itself, ever upgrade cmake to a newer version. This does not work on any Ubuntu release. If your answer is actually "upgrade your Ubuntu system to a newer release" then you may want to edit again to make that clearer. (That would not be a reasonable solution for many users, though, and often there is no released version of Ubuntu whose repositories have the latest version of cmake.)
              – Eliah Kagan
              Aug 23 '17 at 13:55










            2




            2




            ubuntu 12.04 is only shipping v 2.8.7 of cmake with apt-get. The current release of version 2 is 2.8.12. I suggest you persevere with building it from source.
            – Richard Hodges
            Jun 16 '14 at 17:23




            ubuntu 12.04 is only shipping v 2.8.7 of cmake with apt-get. The current release of version 2 is 2.8.12. I suggest you persevere with building it from source.
            – Richard Hodges
            Jun 16 '14 at 17:23




            32




            32




            This is not the correct answer. The latest version is almost never on apt.
            – Senjai
            Feb 20 '15 at 6:09




            This is not the correct answer. The latest version is almost never on apt.
            – Senjai
            Feb 20 '15 at 6:09




            2




            2




            14.04 still shipping 2.8
            – Stolas
            Mar 17 '16 at 9:22




            14.04 still shipping 2.8
            – Stolas
            Mar 17 '16 at 9:22




            2




            2




            This answer is wrong. The StableReleaseUpdates policy is not just for LTS releases. All Ubuntu releases, once actually released, only get fixes for security vulnerabilities or otherwise serious bugs. As shown here (and on Launchpad), even non-LTS releases haven't received new cmake versions. Separate backports for some packages do exist (but not cmake).
            – Eliah Kagan
            Aug 4 '17 at 11:56




            This answer is wrong. The StableReleaseUpdates policy is not just for LTS releases. All Ubuntu releases, once actually released, only get fixes for security vulnerabilities or otherwise serious bugs. As shown here (and on Launchpad), even non-LTS releases haven't received new cmake versions. Separate backports for some packages do exist (but not cmake).
            – Eliah Kagan
            Aug 4 '17 at 11:56




            6




            6




            This answer is wrong because sudo apt-get install cmake does not, by itself, ever upgrade cmake to a newer version. This does not work on any Ubuntu release. If your answer is actually "upgrade your Ubuntu system to a newer release" then you may want to edit again to make that clearer. (That would not be a reasonable solution for many users, though, and often there is no released version of Ubuntu whose repositories have the latest version of cmake.)
            – Eliah Kagan
            Aug 23 '17 at 13:55






            This answer is wrong because sudo apt-get install cmake does not, by itself, ever upgrade cmake to a newer version. This does not work on any Ubuntu release. If your answer is actually "upgrade your Ubuntu system to a newer release" then you may want to edit again to make that clearer. (That would not be a reasonable solution for many users, though, and often there is no released version of Ubuntu whose repositories have the latest version of cmake.)
            – Eliah Kagan
            Aug 23 '17 at 13:55














            up vote
            100
            down vote













            The most common situation is when you want to install the latest version of cmake, but your Operating System's repositories are not updated. For example, in my case I have a laptop running Ubuntu 16.04, and when I executed the command sudo apt install cmake the installed version was 3.5.1; instead of, 3.13.0 which is the current version at cmake.org.



            How can I get the latest version?



            Well, we can install it by following one of this methods:



            A. Building and Installing (recommended)



            A-1. Uninstall the default version provided by Ubuntu's package manager:



            sudo apt remove cmake
            sudo apt purge --auto-remove cmake


            A-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:



            version=3.13
            build=0
            mkdir ~/temp
            cd ~/temp
            wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz
            tar -xzvf cmake-$version.$build.tar.gz
            cd cmake-$version.$build/


            A-3. Install the extracted source by running:



            ./bootstrap
            make -j4
            sudo make install


            A-4. Test your new cmake version.



            $ cmake --version


            Results of cmake --version:



            cmake version 3.13.X

            CMake suite maintained and supported by Kitware (kitware.com/cmake).


            B. Using binary files (cmake-gui wont work well)



            B-1. Uninstall the default version provided by Ubuntu's package manager as in A-1.



            B-2. Go to the official CMake webpage, then download and install the latest .sh version in opt/cmake. Update the version and build variables in the following command to get the desired version:



            version=3.13
            build=0
            mkdir ~/temp
            cd ~/temp
            wget https://cmake.org/files/v$version/cmake-$version.$build-Linux-x86_64.sh
            sudo mkdir /opt/cmake
            sudo sh cmake-$version.$build-Linux-x86_64.sh --prefix=/opt/cmake


            B-3. Add the installed binary link to /usr/local/bin/cmake by running this:



            sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake


            B-4. Test your new cmake version as in A-4.



            Note



            In 3.13.X the X represents the last part of the version that we defined as build. The build may change if cmake is updated. According to the official webpage the Latest Release is 3.13.0. If you want the Previous Release 3.12.4 just replace the version and build parameters like this:



            version=3.12
            build=4





            share|improve this answer



















            • 7




              The make install command need root privileges. The cmake --version command only works after open a new terminal because cmake is installed under /usr/local/bin/ by default, not /usr/bin/.
              – HD189733b
              Jan 22 '17 at 19:10










            • @Teocci, I have long tried to do this in various ways, and only your decision helped me. Thank you very much!!!)))))))
              – neo
              Mar 21 '17 at 13:49










            • I'm glad that this answer helped you. Happy coding and all the best.
              – Teocci
              Mar 22 '17 at 0:19






            • 2




              This is not a solution to UPDATE but to INSTALL cmake. Try this command or google it to find a solution: sudo apt-get remove cmake cmake-data
              – Teocci
              Dec 26 '17 at 2:18








            • 1




              Note to also build the cmake-gui tool, add --qt-gui to the bootstrap command.
              – Richard Whitehead
              Mar 12 at 16:53

















            up vote
            100
            down vote













            The most common situation is when you want to install the latest version of cmake, but your Operating System's repositories are not updated. For example, in my case I have a laptop running Ubuntu 16.04, and when I executed the command sudo apt install cmake the installed version was 3.5.1; instead of, 3.13.0 which is the current version at cmake.org.



            How can I get the latest version?



            Well, we can install it by following one of this methods:



            A. Building and Installing (recommended)



            A-1. Uninstall the default version provided by Ubuntu's package manager:



            sudo apt remove cmake
            sudo apt purge --auto-remove cmake


            A-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:



            version=3.13
            build=0
            mkdir ~/temp
            cd ~/temp
            wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz
            tar -xzvf cmake-$version.$build.tar.gz
            cd cmake-$version.$build/


            A-3. Install the extracted source by running:



            ./bootstrap
            make -j4
            sudo make install


            A-4. Test your new cmake version.



            $ cmake --version


            Results of cmake --version:



            cmake version 3.13.X

            CMake suite maintained and supported by Kitware (kitware.com/cmake).


            B. Using binary files (cmake-gui wont work well)



            B-1. Uninstall the default version provided by Ubuntu's package manager as in A-1.



            B-2. Go to the official CMake webpage, then download and install the latest .sh version in opt/cmake. Update the version and build variables in the following command to get the desired version:



            version=3.13
            build=0
            mkdir ~/temp
            cd ~/temp
            wget https://cmake.org/files/v$version/cmake-$version.$build-Linux-x86_64.sh
            sudo mkdir /opt/cmake
            sudo sh cmake-$version.$build-Linux-x86_64.sh --prefix=/opt/cmake


            B-3. Add the installed binary link to /usr/local/bin/cmake by running this:



            sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake


            B-4. Test your new cmake version as in A-4.



            Note



            In 3.13.X the X represents the last part of the version that we defined as build. The build may change if cmake is updated. According to the official webpage the Latest Release is 3.13.0. If you want the Previous Release 3.12.4 just replace the version and build parameters like this:



            version=3.12
            build=4





            share|improve this answer



















            • 7




              The make install command need root privileges. The cmake --version command only works after open a new terminal because cmake is installed under /usr/local/bin/ by default, not /usr/bin/.
              – HD189733b
              Jan 22 '17 at 19:10










            • @Teocci, I have long tried to do this in various ways, and only your decision helped me. Thank you very much!!!)))))))
              – neo
              Mar 21 '17 at 13:49










            • I'm glad that this answer helped you. Happy coding and all the best.
              – Teocci
              Mar 22 '17 at 0:19






            • 2




              This is not a solution to UPDATE but to INSTALL cmake. Try this command or google it to find a solution: sudo apt-get remove cmake cmake-data
              – Teocci
              Dec 26 '17 at 2:18








            • 1




              Note to also build the cmake-gui tool, add --qt-gui to the bootstrap command.
              – Richard Whitehead
              Mar 12 at 16:53















            up vote
            100
            down vote










            up vote
            100
            down vote









            The most common situation is when you want to install the latest version of cmake, but your Operating System's repositories are not updated. For example, in my case I have a laptop running Ubuntu 16.04, and when I executed the command sudo apt install cmake the installed version was 3.5.1; instead of, 3.13.0 which is the current version at cmake.org.



            How can I get the latest version?



            Well, we can install it by following one of this methods:



            A. Building and Installing (recommended)



            A-1. Uninstall the default version provided by Ubuntu's package manager:



            sudo apt remove cmake
            sudo apt purge --auto-remove cmake


            A-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:



            version=3.13
            build=0
            mkdir ~/temp
            cd ~/temp
            wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz
            tar -xzvf cmake-$version.$build.tar.gz
            cd cmake-$version.$build/


            A-3. Install the extracted source by running:



            ./bootstrap
            make -j4
            sudo make install


            A-4. Test your new cmake version.



            $ cmake --version


            Results of cmake --version:



            cmake version 3.13.X

            CMake suite maintained and supported by Kitware (kitware.com/cmake).


            B. Using binary files (cmake-gui wont work well)



            B-1. Uninstall the default version provided by Ubuntu's package manager as in A-1.



            B-2. Go to the official CMake webpage, then download and install the latest .sh version in opt/cmake. Update the version and build variables in the following command to get the desired version:



            version=3.13
            build=0
            mkdir ~/temp
            cd ~/temp
            wget https://cmake.org/files/v$version/cmake-$version.$build-Linux-x86_64.sh
            sudo mkdir /opt/cmake
            sudo sh cmake-$version.$build-Linux-x86_64.sh --prefix=/opt/cmake


            B-3. Add the installed binary link to /usr/local/bin/cmake by running this:



            sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake


            B-4. Test your new cmake version as in A-4.



            Note



            In 3.13.X the X represents the last part of the version that we defined as build. The build may change if cmake is updated. According to the official webpage the Latest Release is 3.13.0. If you want the Previous Release 3.12.4 just replace the version and build parameters like this:



            version=3.12
            build=4





            share|improve this answer














            The most common situation is when you want to install the latest version of cmake, but your Operating System's repositories are not updated. For example, in my case I have a laptop running Ubuntu 16.04, and when I executed the command sudo apt install cmake the installed version was 3.5.1; instead of, 3.13.0 which is the current version at cmake.org.



            How can I get the latest version?



            Well, we can install it by following one of this methods:



            A. Building and Installing (recommended)



            A-1. Uninstall the default version provided by Ubuntu's package manager:



            sudo apt remove cmake
            sudo apt purge --auto-remove cmake


            A-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:



            version=3.13
            build=0
            mkdir ~/temp
            cd ~/temp
            wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz
            tar -xzvf cmake-$version.$build.tar.gz
            cd cmake-$version.$build/


            A-3. Install the extracted source by running:



            ./bootstrap
            make -j4
            sudo make install


            A-4. Test your new cmake version.



            $ cmake --version


            Results of cmake --version:



            cmake version 3.13.X

            CMake suite maintained and supported by Kitware (kitware.com/cmake).


            B. Using binary files (cmake-gui wont work well)



            B-1. Uninstall the default version provided by Ubuntu's package manager as in A-1.



            B-2. Go to the official CMake webpage, then download and install the latest .sh version in opt/cmake. Update the version and build variables in the following command to get the desired version:



            version=3.13
            build=0
            mkdir ~/temp
            cd ~/temp
            wget https://cmake.org/files/v$version/cmake-$version.$build-Linux-x86_64.sh
            sudo mkdir /opt/cmake
            sudo sh cmake-$version.$build-Linux-x86_64.sh --prefix=/opt/cmake


            B-3. Add the installed binary link to /usr/local/bin/cmake by running this:



            sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake


            B-4. Test your new cmake version as in A-4.



            Note



            In 3.13.X the X represents the last part of the version that we defined as build. The build may change if cmake is updated. According to the official webpage the Latest Release is 3.13.0. If you want the Previous Release 3.12.4 just replace the version and build parameters like this:



            version=3.12
            build=4






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 28 at 0:17

























            answered Dec 28 '16 at 7:50









            Teocci

            1,119257




            1,119257








            • 7




              The make install command need root privileges. The cmake --version command only works after open a new terminal because cmake is installed under /usr/local/bin/ by default, not /usr/bin/.
              – HD189733b
              Jan 22 '17 at 19:10










            • @Teocci, I have long tried to do this in various ways, and only your decision helped me. Thank you very much!!!)))))))
              – neo
              Mar 21 '17 at 13:49










            • I'm glad that this answer helped you. Happy coding and all the best.
              – Teocci
              Mar 22 '17 at 0:19






            • 2




              This is not a solution to UPDATE but to INSTALL cmake. Try this command or google it to find a solution: sudo apt-get remove cmake cmake-data
              – Teocci
              Dec 26 '17 at 2:18








            • 1




              Note to also build the cmake-gui tool, add --qt-gui to the bootstrap command.
              – Richard Whitehead
              Mar 12 at 16:53
















            • 7




              The make install command need root privileges. The cmake --version command only works after open a new terminal because cmake is installed under /usr/local/bin/ by default, not /usr/bin/.
              – HD189733b
              Jan 22 '17 at 19:10










            • @Teocci, I have long tried to do this in various ways, and only your decision helped me. Thank you very much!!!)))))))
              – neo
              Mar 21 '17 at 13:49










            • I'm glad that this answer helped you. Happy coding and all the best.
              – Teocci
              Mar 22 '17 at 0:19






            • 2




              This is not a solution to UPDATE but to INSTALL cmake. Try this command or google it to find a solution: sudo apt-get remove cmake cmake-data
              – Teocci
              Dec 26 '17 at 2:18








            • 1




              Note to also build the cmake-gui tool, add --qt-gui to the bootstrap command.
              – Richard Whitehead
              Mar 12 at 16:53










            7




            7




            The make install command need root privileges. The cmake --version command only works after open a new terminal because cmake is installed under /usr/local/bin/ by default, not /usr/bin/.
            – HD189733b
            Jan 22 '17 at 19:10




            The make install command need root privileges. The cmake --version command only works after open a new terminal because cmake is installed under /usr/local/bin/ by default, not /usr/bin/.
            – HD189733b
            Jan 22 '17 at 19:10












            @Teocci, I have long tried to do this in various ways, and only your decision helped me. Thank you very much!!!)))))))
            – neo
            Mar 21 '17 at 13:49




            @Teocci, I have long tried to do this in various ways, and only your decision helped me. Thank you very much!!!)))))))
            – neo
            Mar 21 '17 at 13:49












            I'm glad that this answer helped you. Happy coding and all the best.
            – Teocci
            Mar 22 '17 at 0:19




            I'm glad that this answer helped you. Happy coding and all the best.
            – Teocci
            Mar 22 '17 at 0:19




            2




            2




            This is not a solution to UPDATE but to INSTALL cmake. Try this command or google it to find a solution: sudo apt-get remove cmake cmake-data
            – Teocci
            Dec 26 '17 at 2:18






            This is not a solution to UPDATE but to INSTALL cmake. Try this command or google it to find a solution: sudo apt-get remove cmake cmake-data
            – Teocci
            Dec 26 '17 at 2:18






            1




            1




            Note to also build the cmake-gui tool, add --qt-gui to the bootstrap command.
            – Richard Whitehead
            Mar 12 at 16:53






            Note to also build the cmake-gui tool, add --qt-gui to the bootstrap command.
            – Richard Whitehead
            Mar 12 at 16:53












            up vote
            36
            down vote













            First uninstall any cmake package previously installed. Then:




            1. Go to http://www.cmake.org/download/ and download the latest .sh installer



            2. Install it (for example) in opt/cmake by running



              sudo mkdir /opt/cmake
              sudo sh <installer filename> --prefix=/opt/cmake


            3. Add the cmake bin directory to your path: https://askubuntu.com/a/170240/359343



            Installed in this way, cmake-gui looks a little bit horrible, if you find a way to fix it please feel free to edit this answer.






            share|improve this answer



















            • 4




              Add a link from /usr/local/bin/cmake to the installed binary. This way there is no need to change the PATH. sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
              – Christian
              Mar 16 '16 at 14:30






            • 2




              This is the best answer.
              – SuB
              Nov 20 '16 at 9:59






            • 2




              really, this is most useful answer for initial question
              – amigo421
              Dec 1 '16 at 19:37










            • This gives me broken cmake-gui, which doesn't work over xRDP (prev version worked), and xRDP is the only way to access the server.
              – stiv
              Mar 28 at 18:56










            • @stiv 1. Did you verify cmake after the installation is working, and that you have no other cmake version in your path? 2. Can you verify if you are using the cmake-gui provided in the installation, and not some older version? (To know the version, append --version to the command line)
              – Antonio
              Mar 29 at 16:22

















            up vote
            36
            down vote













            First uninstall any cmake package previously installed. Then:




            1. Go to http://www.cmake.org/download/ and download the latest .sh installer



            2. Install it (for example) in opt/cmake by running



              sudo mkdir /opt/cmake
              sudo sh <installer filename> --prefix=/opt/cmake


            3. Add the cmake bin directory to your path: https://askubuntu.com/a/170240/359343



            Installed in this way, cmake-gui looks a little bit horrible, if you find a way to fix it please feel free to edit this answer.






            share|improve this answer



















            • 4




              Add a link from /usr/local/bin/cmake to the installed binary. This way there is no need to change the PATH. sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
              – Christian
              Mar 16 '16 at 14:30






            • 2




              This is the best answer.
              – SuB
              Nov 20 '16 at 9:59






            • 2




              really, this is most useful answer for initial question
              – amigo421
              Dec 1 '16 at 19:37










            • This gives me broken cmake-gui, which doesn't work over xRDP (prev version worked), and xRDP is the only way to access the server.
              – stiv
              Mar 28 at 18:56










            • @stiv 1. Did you verify cmake after the installation is working, and that you have no other cmake version in your path? 2. Can you verify if you are using the cmake-gui provided in the installation, and not some older version? (To know the version, append --version to the command line)
              – Antonio
              Mar 29 at 16:22















            up vote
            36
            down vote










            up vote
            36
            down vote









            First uninstall any cmake package previously installed. Then:




            1. Go to http://www.cmake.org/download/ and download the latest .sh installer



            2. Install it (for example) in opt/cmake by running



              sudo mkdir /opt/cmake
              sudo sh <installer filename> --prefix=/opt/cmake


            3. Add the cmake bin directory to your path: https://askubuntu.com/a/170240/359343



            Installed in this way, cmake-gui looks a little bit horrible, if you find a way to fix it please feel free to edit this answer.






            share|improve this answer














            First uninstall any cmake package previously installed. Then:




            1. Go to http://www.cmake.org/download/ and download the latest .sh installer



            2. Install it (for example) in opt/cmake by running



              sudo mkdir /opt/cmake
              sudo sh <installer filename> --prefix=/opt/cmake


            3. Add the cmake bin directory to your path: https://askubuntu.com/a/170240/359343



            Installed in this way, cmake-gui looks a little bit horrible, if you find a way to fix it please feel free to edit this answer.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Sep 19 '17 at 23:42

























            answered Mar 11 '15 at 9:00









            Antonio

            680614




            680614








            • 4




              Add a link from /usr/local/bin/cmake to the installed binary. This way there is no need to change the PATH. sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
              – Christian
              Mar 16 '16 at 14:30






            • 2




              This is the best answer.
              – SuB
              Nov 20 '16 at 9:59






            • 2




              really, this is most useful answer for initial question
              – amigo421
              Dec 1 '16 at 19:37










            • This gives me broken cmake-gui, which doesn't work over xRDP (prev version worked), and xRDP is the only way to access the server.
              – stiv
              Mar 28 at 18:56










            • @stiv 1. Did you verify cmake after the installation is working, and that you have no other cmake version in your path? 2. Can you verify if you are using the cmake-gui provided in the installation, and not some older version? (To know the version, append --version to the command line)
              – Antonio
              Mar 29 at 16:22
















            • 4




              Add a link from /usr/local/bin/cmake to the installed binary. This way there is no need to change the PATH. sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
              – Christian
              Mar 16 '16 at 14:30






            • 2




              This is the best answer.
              – SuB
              Nov 20 '16 at 9:59






            • 2




              really, this is most useful answer for initial question
              – amigo421
              Dec 1 '16 at 19:37










            • This gives me broken cmake-gui, which doesn't work over xRDP (prev version worked), and xRDP is the only way to access the server.
              – stiv
              Mar 28 at 18:56










            • @stiv 1. Did you verify cmake after the installation is working, and that you have no other cmake version in your path? 2. Can you verify if you are using the cmake-gui provided in the installation, and not some older version? (To know the version, append --version to the command line)
              – Antonio
              Mar 29 at 16:22










            4




            4




            Add a link from /usr/local/bin/cmake to the installed binary. This way there is no need to change the PATH. sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
            – Christian
            Mar 16 '16 at 14:30




            Add a link from /usr/local/bin/cmake to the installed binary. This way there is no need to change the PATH. sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
            – Christian
            Mar 16 '16 at 14:30




            2




            2




            This is the best answer.
            – SuB
            Nov 20 '16 at 9:59




            This is the best answer.
            – SuB
            Nov 20 '16 at 9:59




            2




            2




            really, this is most useful answer for initial question
            – amigo421
            Dec 1 '16 at 19:37




            really, this is most useful answer for initial question
            – amigo421
            Dec 1 '16 at 19:37












            This gives me broken cmake-gui, which doesn't work over xRDP (prev version worked), and xRDP is the only way to access the server.
            – stiv
            Mar 28 at 18:56




            This gives me broken cmake-gui, which doesn't work over xRDP (prev version worked), and xRDP is the only way to access the server.
            – stiv
            Mar 28 at 18:56












            @stiv 1. Did you verify cmake after the installation is working, and that you have no other cmake version in your path? 2. Can you verify if you are using the cmake-gui provided in the installation, and not some older version? (To know the version, append --version to the command line)
            – Antonio
            Mar 29 at 16:22






            @stiv 1. Did you verify cmake after the installation is working, and that you have no other cmake version in your path? 2. Can you verify if you are using the cmake-gui provided in the installation, and not some older version? (To know the version, append --version to the command line)
            – Antonio
            Mar 29 at 16:22












            up vote
            16
            down vote













            Just in case if someone need to install latest CMAKE in a docker image (like me..). In this case is 3.7.2, but you can check here https://cmake.org/download/ as already pointed out



            #install latest cmake
            ADD https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.sh /cmake-3.7.2-Linux-x86_64.sh
            RUN mkdir /opt/cmake
            RUN sh /cmake-3.7.2-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
            RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
            RUN cmake --version





            share|improve this answer





















            • Nice, undocumented --skip-license option :)
              – 4LegsDrivenCat
              Jun 15 '17 at 4:22















            up vote
            16
            down vote













            Just in case if someone need to install latest CMAKE in a docker image (like me..). In this case is 3.7.2, but you can check here https://cmake.org/download/ as already pointed out



            #install latest cmake
            ADD https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.sh /cmake-3.7.2-Linux-x86_64.sh
            RUN mkdir /opt/cmake
            RUN sh /cmake-3.7.2-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
            RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
            RUN cmake --version





            share|improve this answer





















            • Nice, undocumented --skip-license option :)
              – 4LegsDrivenCat
              Jun 15 '17 at 4:22













            up vote
            16
            down vote










            up vote
            16
            down vote









            Just in case if someone need to install latest CMAKE in a docker image (like me..). In this case is 3.7.2, but you can check here https://cmake.org/download/ as already pointed out



            #install latest cmake
            ADD https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.sh /cmake-3.7.2-Linux-x86_64.sh
            RUN mkdir /opt/cmake
            RUN sh /cmake-3.7.2-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
            RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
            RUN cmake --version





            share|improve this answer












            Just in case if someone need to install latest CMAKE in a docker image (like me..). In this case is 3.7.2, but you can check here https://cmake.org/download/ as already pointed out



            #install latest cmake
            ADD https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.sh /cmake-3.7.2-Linux-x86_64.sh
            RUN mkdir /opt/cmake
            RUN sh /cmake-3.7.2-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
            RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
            RUN cmake --version






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 4 '17 at 11:15









            Paolo Vigori

            26122




            26122












            • Nice, undocumented --skip-license option :)
              – 4LegsDrivenCat
              Jun 15 '17 at 4:22


















            • Nice, undocumented --skip-license option :)
              – 4LegsDrivenCat
              Jun 15 '17 at 4:22
















            Nice, undocumented --skip-license option :)
            – 4LegsDrivenCat
            Jun 15 '17 at 4:22




            Nice, undocumented --skip-license option :)
            – 4LegsDrivenCat
            Jun 15 '17 at 4:22










            up vote
            4
            down vote













            You can also execute the following:



            export fn=/tmp/cmake.sh && ls $fn && (echo "use previous $fn? Enter for yes, ctrl+d for no." && read) || (wget -O $fn http://www.cmake.org/files/v3.0/cmake-3.0.2-Linux-i386.sh 1>&2) && (cd /opt && sudo bash ${fn} && echo sudo ln -f -s /opt/cmake*/bin/cmake /usr/local/bin/cmake && cd -)


            This script




            • fetches make 3.0.2
              ** if it was already downloaded in this session, then you might reuse it if you did not finish the installation

            • then it copies makes link to the bin cmake.






            share|improve this answer

























              up vote
              4
              down vote













              You can also execute the following:



              export fn=/tmp/cmake.sh && ls $fn && (echo "use previous $fn? Enter for yes, ctrl+d for no." && read) || (wget -O $fn http://www.cmake.org/files/v3.0/cmake-3.0.2-Linux-i386.sh 1>&2) && (cd /opt && sudo bash ${fn} && echo sudo ln -f -s /opt/cmake*/bin/cmake /usr/local/bin/cmake && cd -)


              This script




              • fetches make 3.0.2
                ** if it was already downloaded in this session, then you might reuse it if you did not finish the installation

              • then it copies makes link to the bin cmake.






              share|improve this answer























                up vote
                4
                down vote










                up vote
                4
                down vote









                You can also execute the following:



                export fn=/tmp/cmake.sh && ls $fn && (echo "use previous $fn? Enter for yes, ctrl+d for no." && read) || (wget -O $fn http://www.cmake.org/files/v3.0/cmake-3.0.2-Linux-i386.sh 1>&2) && (cd /opt && sudo bash ${fn} && echo sudo ln -f -s /opt/cmake*/bin/cmake /usr/local/bin/cmake && cd -)


                This script




                • fetches make 3.0.2
                  ** if it was already downloaded in this session, then you might reuse it if you did not finish the installation

                • then it copies makes link to the bin cmake.






                share|improve this answer












                You can also execute the following:



                export fn=/tmp/cmake.sh && ls $fn && (echo "use previous $fn? Enter for yes, ctrl+d for no." && read) || (wget -O $fn http://www.cmake.org/files/v3.0/cmake-3.0.2-Linux-i386.sh 1>&2) && (cd /opt && sudo bash ${fn} && echo sudo ln -f -s /opt/cmake*/bin/cmake /usr/local/bin/cmake && cd -)


                This script




                • fetches make 3.0.2
                  ** if it was already downloaded in this session, then you might reuse it if you did not finish the installation

                • then it copies makes link to the bin cmake.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Oct 2 '14 at 23:11









                test30

                42947




                42947






















                    up vote
                    4
                    down vote













                    I love the following way because you can get a recent version without much trouble.



                    Kitware seems to officially support a pip wheels release. So you can get latest cmake just by doing:




                    pip install --upgrade cmake




                    Here is the blog about it:
                    https://blog.kitware.com/cmake-python-wheels/






                    share|improve this answer

























                      up vote
                      4
                      down vote













                      I love the following way because you can get a recent version without much trouble.



                      Kitware seems to officially support a pip wheels release. So you can get latest cmake just by doing:




                      pip install --upgrade cmake




                      Here is the blog about it:
                      https://blog.kitware.com/cmake-python-wheels/






                      share|improve this answer























                        up vote
                        4
                        down vote










                        up vote
                        4
                        down vote









                        I love the following way because you can get a recent version without much trouble.



                        Kitware seems to officially support a pip wheels release. So you can get latest cmake just by doing:




                        pip install --upgrade cmake




                        Here is the blog about it:
                        https://blog.kitware.com/cmake-python-wheels/






                        share|improve this answer












                        I love the following way because you can get a recent version without much trouble.



                        Kitware seems to officially support a pip wheels release. So you can get latest cmake just by doing:




                        pip install --upgrade cmake




                        Here is the blog about it:
                        https://blog.kitware.com/cmake-python-wheels/







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Aug 31 at 8:46









                        purpletentacle

                        5452823




                        5452823






















                            up vote
                            2
                            down vote













                            Remove old version using:



                            apt-get purge cmake


                            Download binary version of cmake archived in a tarball. 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!






                            share|improve this answer

























                              up vote
                              2
                              down vote













                              Remove old version using:



                              apt-get purge cmake


                              Download binary version of cmake archived in a tarball. 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!






                              share|improve this answer























                                up vote
                                2
                                down vote










                                up vote
                                2
                                down vote









                                Remove old version using:



                                apt-get purge cmake


                                Download binary version of cmake archived in a tarball. 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!






                                share|improve this answer












                                Remove old version using:



                                apt-get purge cmake


                                Download binary version of cmake archived in a tarball. 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!







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Nov 20 '16 at 10:02









                                SuB

                                1,95721530




                                1,95721530






















                                    up vote
                                    0
                                    down vote













                                    For a Docker container, best run



                                    RUN wget -qO- "https://cmake.org/files/v3.12/cmake-3.12.1-Linux-x86_64.tar.gz" | 
                                    tar --strip-components=1 -xz -C /usr/local


                                    Adjust the version, if needed.






                                    share|improve this answer

























                                      up vote
                                      0
                                      down vote













                                      For a Docker container, best run



                                      RUN wget -qO- "https://cmake.org/files/v3.12/cmake-3.12.1-Linux-x86_64.tar.gz" | 
                                      tar --strip-components=1 -xz -C /usr/local


                                      Adjust the version, if needed.






                                      share|improve this answer























                                        up vote
                                        0
                                        down vote










                                        up vote
                                        0
                                        down vote









                                        For a Docker container, best run



                                        RUN wget -qO- "https://cmake.org/files/v3.12/cmake-3.12.1-Linux-x86_64.tar.gz" | 
                                        tar --strip-components=1 -xz -C /usr/local


                                        Adjust the version, if needed.






                                        share|improve this answer












                                        For a Docker container, best run



                                        RUN wget -qO- "https://cmake.org/files/v3.12/cmake-3.12.1-Linux-x86_64.tar.gz" | 
                                        tar --strip-components=1 -xz -C /usr/local


                                        Adjust the version, if needed.







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Aug 28 at 17:25









                                        sebastian

                                        1034




                                        1034






















                                            up vote
                                            0
                                            down vote













                                            Install the latest version of cmake from backports, where many latest versions reside. The particular backports depends on your current OS version. For example, running Debian Stretch, add the following to /etc/apt/sources.list



                                            deb http://ftp.debian.org/debian stretch-backports main


                                            Then install from this backport, aka:



                                            sudo apt-get -t stretch-backports install -y cmake





                                            share|improve this answer

























                                              up vote
                                              0
                                              down vote













                                              Install the latest version of cmake from backports, where many latest versions reside. The particular backports depends on your current OS version. For example, running Debian Stretch, add the following to /etc/apt/sources.list



                                              deb http://ftp.debian.org/debian stretch-backports main


                                              Then install from this backport, aka:



                                              sudo apt-get -t stretch-backports install -y cmake





                                              share|improve this answer























                                                up vote
                                                0
                                                down vote










                                                up vote
                                                0
                                                down vote









                                                Install the latest version of cmake from backports, where many latest versions reside. The particular backports depends on your current OS version. For example, running Debian Stretch, add the following to /etc/apt/sources.list



                                                deb http://ftp.debian.org/debian stretch-backports main


                                                Then install from this backport, aka:



                                                sudo apt-get -t stretch-backports install -y cmake





                                                share|improve this answer












                                                Install the latest version of cmake from backports, where many latest versions reside. The particular backports depends on your current OS version. For example, running Debian Stretch, add the following to /etc/apt/sources.list



                                                deb http://ftp.debian.org/debian stretch-backports main


                                                Then install from this backport, aka:



                                                sudo apt-get -t stretch-backports install -y cmake






                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Dec 1 at 4:31









                                                jeffmcneill

                                                1236




                                                1236






























                                                    draft saved

                                                    draft discarded




















































                                                    Thanks for contributing an answer to Ask Ubuntu!


                                                    • Please be sure to answer the question. Provide details and share your research!

                                                    But avoid



                                                    • Asking for help, clarification, or responding to other answers.

                                                    • Making statements based on opinion; back them up with references or personal experience.


                                                    To learn more, see our tips on writing great answers.





                                                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                                    Please pay close attention to the following guidance:


                                                    • Please be sure to answer the question. Provide details and share your research!

                                                    But avoid



                                                    • Asking for help, clarification, or responding to other answers.

                                                    • Making statements based on opinion; back them up with references or personal experience.


                                                    To learn more, see our tips on writing great answers.




                                                    draft saved


                                                    draft discarded














                                                    StackExchange.ready(
                                                    function () {
                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f355565%2fhow-do-i-install-the-latest-version-of-cmake-from-the-command-line%23new-answer', 'question_page');
                                                    }
                                                    );

                                                    Post as a guest















                                                    Required, but never shown





















































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown

































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown







                                                    Popular posts from this blog

                                                    Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

                                                    ComboBox Display Member on multiple fields

                                                    Is it possible to collect Nectar points via Trainline?