In this post, we show you how to install CMake on Ubuntu by means of a GUI and how-to. Our choice of Ubuntu in this tutorial is Ubuntu 18.04 LTS.
CMake is a free, open source, cross-platform software tool designed to build, test and package software. CMake uses a simple platform and independent-compiler configuration file to control the software compilation process. This leads to the production of native makefiles and workspaces, which, in turn, are used in the preferred compiler environment.
In this post, we will show you how to install CMake on your Ubuntu system. Our choice of Ubuntu in this tutorial is Ubuntu 18.04 LTS.
Install CMake on Ubuntu
Before installing CMake, make sure you have the most advanced root and system privileges by running the command below.
sudo apt update sudo apt upgrade
Method 1: Install CMake using the Ubuntu Software
If you don’t want to run lots of commands on Terminal Linux, then this method is for you. At the time of writing this post, the stable version of CMake available is 3.17.3.
Step 1. Launch “Install Ubuntu Software” from the Ubuntu application menu, as shown in the image below.
Launch Software Installation from the Ubuntu Apps
Step 2. In the “Search Bar” in the Ubuntu Software at the top, type the word CMake and press “Enter.” You will see a list of applications but just click on the CMake icon. This will probably be the first item in the list, as shown in the image below.
Look for CMake in the Search Bar
Step 3. Click on the “Install” button to download and install CMake on your Ubuntu system. You may be asked to enter the root password to continue the installation.
Click the Install button to install CMake on your system.
Step 4. You can track the installation progress using the percentage below, as shown in the figure.
See Installation progress in the Percentage bar.
CMake will now install on your system. If the process completes successfully, you will see a window similar to the one in the image below.
Launch CMake after successful installation
Step 5. To start CMake, click the “Launch” button. The CMake window must open, as shown in the image below.
Uninstall CMake using the Ubuntu Software
If you want to delete CMake from your system using the Graphical User Interface GUI), it’s very easy.
Step 1. Open the Ubuntu Software application and search for “CMake” in the search bar above.
Step 2. Click on the CMake application that appears on the list. You will see a window similar to the one below.
Uninstall / Uninstall CMake.
Step 3. Click on the “Delete” button to uninstall CMake from your Ubuntu system.
Remove CMake on Ubuntu
From the image below, we can see “CMake” is uninstalling your system.
Method 2: Install CMake using the command line
This is the method that must be followed to install CMake on your Ubuntu system to those who prefer the Command-line method over the Graphical User Interface. There are two ways that you can use to install CMake on your system through Terminal:
a) Using snap
b) Use the source code from the official CMake website
Step 1. Run the Ubuntu Terminal and run the command below.
sudo snap install cmake -classic
After the installation is complete, run the “–version” command below to see the version of CMake installed on your system.
Install CMake via snap
To delete / uninstall using a snap in the command line, run the command below.
sudo snap remove cmake
Note, this method only works for CMake that is installed via Snap or the Graphic method using the Ubuntu Software.
Remove CMake using Snap
Install CMake using Source Code VI
Before writing this post, I tried installing CMake from the Ubuntu and PPA repositories, but no one installed the latest CMake version. To install the latest CMake version, follow the steps below.
Step 1. Download the CMake source code from the official website. That can be done using the “wget” command in Terminal, as shown below. Be sure to replace the link in the command below with the link that you copied from the official website.
$ wget https://github.com/Kitware/CMake/releases/download/v3.17.3/cmake-3.17.3.tar.gz
Download the source code using wget
Step 2. Navigate to the directory where you downloaded the code. It should be the folder where you run the “wget” command. Run the “tar” command to extract content.
tar -zxvf cmake-3.17.3.tar.gz
Extract the source code using the tar command
Step 3. Navigate to the newly created CMake directory using the “cd” command.
Navigate to the CMake directory
Step 4. Run the command below to compile and install CMake on your Ubuntu system.
Configure and Install CMake
After the process is complete, you will see a message, like in the picture below.
CMake successfully bootstrapped
Step 5. Run the “make” command.
Run the make command
Step 6. Run the “make install” command to install CMake on your system.
Create the Install command
Step 7. To confirm that CMake is successfully installed on your system, run the “version” command.
To Uninstall / Uninstall a CMake that was installed using the “make” command, run the command below.
sudo make uninstall
Those are two ways to install CMake on your Ubuntu system. If you are new to CMake and want to know more about it, visit the official website to read their comprehensive documentation.