{"id":4695,"date":"2019-05-23T11:19:47","date_gmt":"2019-05-23T05:49:47","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=4695"},"modified":"2026-10-24T16:07:00","modified_gmt":"2026-10-24T10:37:00","slug":"how-to-install-cmake-form-source-on-linux","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-install-cmake-form-source-on-linux\/","title":{"rendered":"How to Install Cmake form source on Linux."},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong><strong>Post Date:<\/strong><\/strong> May 22, 2019<strong><br><strong>Last Updated:<\/strong> <\/strong>October 23, 2026<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">CMake is an open-source, cross-platform build system generator that helps developers manage the build process of software projects. It generates build files for tools such as GNU Make and Ninja, making it easier to configure, compile, and install applications from source code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Although CMake is available through most Linux package managers, installing it from source is useful when you need a specific version, want greater control over the installation, or require a version that is not available in your distribution&#8217;s repositories.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this guide, we will explain how to download the CMake source code, extract the archive, configure the build environment, compile the source, and install CMake on a Linux system.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you prefer installing CMake through your package manager, refer to our guide: <a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-install-cmake-on-linux\/\">How to Install CMake on Linux<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before proceeding with the installation, ensure that the following requirements are met:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li><strong>Linux operating system:<\/strong> A supported Linux distribution such as Ubuntu or Debian.<\/li>\n\n\n\n<li><strong>Root or sudo access:<\/strong> Required to install CMake into a system-wide directory.<\/li>\n\n\n\n<li><strong>Build tools:<\/strong> A C\/C++ compiler, GNU Make, and other required development utilities.<\/li>\n\n\n\n<li><strong>Internet connection:<\/strong> Required to download the CMake source archive.<\/li>\n\n\n\n<li><strong>Available disk space:<\/strong> Sufficient space to download, compile, and install the source files.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Check the official <a href=\"https:\/\/cmake.org\/download\/\" target=\"_blank\" rel=\"noopener\">CMake download page<\/a> for the latest stable release and select a version compatible with your system and project requirements.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step-by-Step Guide to Install CMake from Source<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Install the Required Dependencies<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">On Ubuntu or Debian, update the package list and install the necessary build tools.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt update\nsudo apt install build-essential wget ca-certificates<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Verify that the compiler and Make utility are available.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">gcc --version\nmake --version<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Download the CMake Source Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to the <code>\/root<\/code> directory or another suitable working directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cd \/root<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Download the CMake source archive. The following example uses CMake version 3.14.4 from the original guide. For a new installation, replace the version and download URL with your selected release from the official CMake website.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">wget https:\/\/github.com\/Kitware\/CMake\/releases\/download\/v3.14.4\/cmake-3.14.4.tar.gz<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The archive will be downloaded to the current directory.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Extract the Source Archive<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Use the <code>tar<\/code> command to extract the downloaded archive.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">tar -xzf cmake-3.14.4.tar.gz<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Move into the extracted source directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cd cmake-3.14.4<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can list the directory contents to confirm that the source files have been extracted.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ls<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Configure the CMake Build<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run the bootstrap script from the extracted source directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">.\/bootstrap<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The bootstrap script checks the build environment and prepares the configuration required to compile CMake.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This process may take several minutes, depending on your system&#8217;s performance and installed dependencies.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Wait until the configuration completes successfully before proceeding to the next step.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> Use <code>.\/bootstrap<\/code> for the standard CMake source-build procedure rather than assuming that a <code>.\/configure<\/code> script is available.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Compile CMake from Source<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After the configuration completes, run the following command to compile the source code.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">make -j\"$(nproc)\"<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>-j\"$(nproc)\"<\/code> option allows Make to use the number of available processing units to perform parallel compilation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Compilation time depends on the CPU, available memory, and system resources. If your server has limited memory, use a smaller number of parallel jobs, such as <code>make -j2<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Wait for the compilation to finish successfully before continuing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 6: Install CMake<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once compilation is complete, install CMake using the following command.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo make install<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">By default, the installation generally places CMake under <code>\/usr\/local<\/code>, making it available system-wide when the relevant directories are included in the system&#8217;s <code>PATH<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 7: Verify the Installation<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After the installation finishes, verify the installed CMake version.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cmake --version<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For the example installation, the output should identify CMake version <code>3.14.4<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the command reports a different version, check whether another CMake installation appears earlier in your <code>PATH<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installation Flowchart<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The following flowchart summarizes the complete installation process.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/a_clean_infographic_flowchart_on_a_white_backgroun.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"683\" height=\"1024\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/a_clean_infographic_flowchart_on_a_white_backgroun-683x1024.png\" alt=\"Flowchart showing how to install CMake from source on Linux, including downloading the source code, running bootstrap, compiling with make, installing CMake, and verifying the installation.\" class=\"wp-image-12481\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/a_clean_infographic_flowchart_on_a_white_backgroun-683x1024.png 683w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/a_clean_infographic_flowchart_on_a_white_backgroun-200x300.png 200w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/a_clean_infographic_flowchart_on_a_white_backgroun-768x1152.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/a_clean_infographic_flowchart_on_a_white_backgroun.png 1024w\" sizes=\"(max-width: 683px) 100vw, 683px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">How to Uninstall CMake<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The uninstall procedure depends on how CMake was installed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>If CMake was installed through APT:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use the following command to remove the package and its automatically installed dependencies that are no longer required.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt-get remove --auto-remove cmake<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>If CMake was compiled and installed from source:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The APT removal command does not normally remove a source installation under <code>\/usr\/local<\/code>. Check the installation prefix and remove the installed files using a suitable removal procedure. If the source build supports an uninstall target, check it before use; otherwise, remove only the files belonging to that installation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Avoid deleting shared directories or files that may belong to other software.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Installing CMake from source on Linux gives you control over the version and installation process. By installing the required dependencies, downloading and extracting the source archive, running the bootstrap script, compiling the code, and installing the resulting files, you can set up CMake on your Linux system.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, run <code>cmake --version<\/code> to confirm that the installation is working correctly. For production systems, choose a supported release that meets your project&#8217;s requirements and keep the installation updated as needed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions (FAQs)<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Why should I install CMake from source instead of using APT?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Installing from source lets you select a specific version and use a release that may not be available in your distribution&#8217;s package repository. However, package-manager installation is generally easier to maintain and update.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. How can I check whether CMake is installed correctly?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cmake --version<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It displays the version of CMake found through your current <code>PATH<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. What should I do if the CMake compilation fails?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Check the error messages for missing dependencies, compiler problems, insufficient memory, or configuration issues. Install the required dependencies, rerun <code>.\/bootstrap<\/code> if necessary, and retry the compilation. For systems with limited memory, reduce the number of parallel Make jobs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/pheonixsolutions.com\/blog\/how-the-linux-kernel-handles-network-connections-using-dns-and-routing\/\">How the Linux Kernel Handles Network Connections Using DNS and Routing<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/pheonixsolutions.com\/blog\/modifying-file-timestamps-in-linux-using-touch\/\">Modifying File Timestamps in Linux Using touch<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Need Assistance?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you encounter issues installing CMake or configuring your Linux build environment, please contact the <a href=\"https:\/\/pheonixsolutions.com\/\">Pheonix Solutions<\/a> support team. Include your Linux distribution, version, and any error messages so our team can investigate and assist you.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For further assistance, please <a href=\"https:\/\/pheonixsolutions.com\/contact\/\">contact our support team<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Post Date: May 22, 2019Last Updated: October 23, 2026 Introduction CMake is an open-source, cross-platform build system generator that helps [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":12482,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[664],"class_list":["post-4695","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-architecture","tag-install-cmake-form-source","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-1dJ","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/CMake-Source-Installation-on-Linux.png","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4695","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=4695"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4695\/revisions"}],"predecessor-version":[{"id":12483,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4695\/revisions\/12483"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media\/12482"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=4695"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=4695"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=4695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}