How to install CMake on Ubuntu 18.04 LTS

CMake is an open-source, cross-platform family of tools for building, testing, and packaging software. CMake is used to control the process of compiling software using simple configuration files that are independent of the platform and the compiler, as well as to create your own makefiles and workspaces that you can use in your compiler environment. Kitware created the CMake toolkit in response to the need for a powerful cross-platform build environment for open source projects such as ITK and VTK.

In this article, we will describe how you can install CMake on Ubuntu both through the user interface and from the command line.

We ran the commands and procedures mentioned in this article on the Ubuntu 18.04 LTS system.

Install CMake via Ubuntu UI

At the time of this writing, the latest version of CMake was 3.15.2 and, fortunately, is available through the Snap Store. Here we explain how you can install it through Ubuntu Software Manager.


For a person who does not want to open the command line much, installing the software present in the Ubuntu repository through the user interface is very simple. On the Actions toolbar on the Ubuntu desktop, click the Ubuntu Software icon.

In the next window, click on the search icon and enter “CMake” in the search bar. Search results will display Cmake as follows:

CMake Search

The first package listed in the search results is a package supported by the Snap Store. In the software manager, click the CMake entry to open the following view:

Install CMake

Click the Install button to start the installation process. The next authentication dialog will show you the opportunity to provide your authentication information, since only an authorized user can install the software in Ubuntu

Authenticate as administrator

Enter your password and click the Authentication button. After that, the installation process will begin, displaying a progress bar as follows.

Installation Progress

Then CMake will be installed on your system, and after successful installation you will receive the following message:

Run CMake

In the above dialog box, you can directly launch CMake and even remove it immediately for any reason.

Remarks: The same software version can be installed via the command line using the following command:

$ sudo snap install cmake

Remove CMake

If you want to remove CMake, which was installed in the above way, you can remove it from your system as follows:

Open Ubuntu Software Manager and find CMake. You will see the “Installed” status in the search bar. Click this entry, and then click Delete from the following view:

Remove CMake

Then the system will offer you an authentication dialog. The software will be removed when you provide the password for the sudo user and click the “Authentication” button in the dialog box.

Install CMake via Ubuntu Command Prompt

If you prefer the command line rather than the user interface, here is the method you will need to follow to install the latest version of CMake. I also tried installing CMake through standard Ubuntu repositories as well as through PPA, but none of them gave me the latest version. The only working method involves downloading the source code from the official CMake website “”, compiling it, and then installing CMake through it.

Open the Ubuntu command line, Terminal or through Ctrl + Alt + T shortcut or through the search application launcher.

Then enter the following command to download the source code:

$ wget

After loading the tar.gz file, enter the following command to extract it:

$ tar -zxvf cmake-3.15.2.tar.gz

Then navigate to the extracted folder as follows:

$ cd cmake-3.15.2

Finally, run the following commands to compile and install CMake:


Self-loading CMake

When CMake boots up, you get the following output:

Now run make

Now you can do this with the following command:

$ make

And then install it as follows:

$ sudo make install

Make CMake Installation

After successfully installing the software, you can verify its installation, and also, if the correct version is installed, using the following command:

$ cmake --version

Check CMake Version

You can see that CMake 1.15.2, which was the latest software at the time of this writing, is installed on my Ubuntu. Now you can use the CLI tool to work with your software code.

How to install CMake on Ubuntu 18.04 LTS