CMake Installation and Configuration
Operating systems supported by CMake:
- Microsoft Windows
- Apple macOS
- Linux
- FreeBSD
- OpenBSD
- Solaris
- AIX
Installing CMake
CMake can be installed on different operating systems; this article covers installation and configuration on Windows, Linux and macOS.
CMake installer download page:https://cmake.org/download/.
The download page includes source packages and binary packages:

From the binary package list above you can download the installer for your operating system.
Windows
Choose the Windows installer (usually an .msi file).
After downloading, double-click the .msi file and follow the installation wizard.

During installation you can choose to add CMake to the system PATH environment variable (recommended, so the cmake command is available directly from the command line).

**Verify installation:** Open Command Prompt (CMD) or PowerShell, type cmake --version, and check that the CMake version information is displayed correctly.
macOS
Install via Homebrew
Open Terminal and run the following install command:
brew install cmake
Via the official installer
Visit the download page on the CMake website and choose the macOS .dmg file.
Download and run the .dmg file, then drag the CMake icon into the Applications folder.

After installation the commands live in /Applications/CMake.app/Contents/bin, so we need to add the environment variable to the .bash_profile file, editing it with vim:
vim ~/.bash_profile
Add the following to the end of the file:
export PATH="/Applications/CMake.app/Contents/bin":"$PATH"
After adding it, run source ~/.bash_profile or restart the terminal.
**Verify installation:** Open Terminal, type cmake --version, and confirm CMake is installed correctly.
Linux
Install via a package manager (works for most distributions):
- For Ubuntu or Debian: sudo apt-get install cmake
- For Fedora: sudo dnf install cmake
- For Arch Linux: sudo pacman -S cmake
Install from source:
Visit the CMake website and download the source package.
Extract the source package and enter the extracted directory.
Run the following commands to compile and install:
./bootstrap
make
sudo make install
**Verify installation:** Open Terminal, type cmake --version, and confirm CMake is installed successfully.
Configuring CMake
Make sure the CMake installation path is added to the system PATH environment variable so CMake is accessible from the command line anywhere.
Windows environment variable settings
If you chose to add CMake to PATH during installation, no extra configuration is needed.
If not, add it manually: right-click "Computer" or "This PC", choose "Properties" -> "Advanced system settings" -> "Environment Variables", find Path under "System variables", click "Edit", and add the CMake installation path.
macOS and Linux
The installer usually configures PATH automatically; if not, you can configure it manually.
Open a terminal, edit ~/.bash_profile or ~/.zshrc, and add the following line:
export PATH="/usr/local/bin:$PATH"
Run source ~/.bash_profile or source ~/.zshrc to apply the changes.
CMake GUI
CMake also provides a graphical user interface (GUI) for more intuitive project configuration.
On Windows it can usually be launched from the Start menu.

On macOS and Linux, launch it with the terminal command cmake-gui.

Set the source directory and the build directory:
- Source Code Directory: Points to the directory containing CMakeLists.txt.
- Build Directory: Points to the directory that holds the generated build files. A separate directory is recommended to keep the source tree clean.
Configure and generate:
- Click the "Configure" button, choose the compiler and build options, and CMake checks dependencies and generates the configuration.
- Click the "Generate" button and CMake generates build files suited to the current platform.
With the steps above, users can install and configure CMake and have it ready to build and manage projects.