# 使用 Homebrew, apk, chocolatey, apt, dnf, MacPorts, Nix, pacman, zypper, scoop, winget 安装 cmake

查看 cmake 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:cmake
```

## 代理安全回答

cmake configures native builds and can run project-defined build commands.

- **凭据访问:** Reads environment variables, toolchain files, and project config.
- **远程变更:** Usually local, but custom commands can call external services.
- **发布/制品风险:** Can produce native release artifacts and installer packages.
- **推荐控制:** Gate install/package targets and custom commands that use secrets.
- **代理使用指南:** Allow configure/build in scanned worktrees; require approval for install, package, and secret-backed custom targets.

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install cmake
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install cmake
```

  证据: MacPorts ports tree: devel/cmake/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add cmake
```

  证据: Alpine Linux edge package indexes: cmake from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install cmake
```

  证据: Debian stable package indexes: cmake from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install cmake
```

  证据: Fedora Rawhide package metadata: cmake from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#cmake
```

  证据: nixpkgs package indexes: pkgs/by-name/cm/cmake/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S cmake
```

  证据: Arch Linux sync databases: cmake from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install cmake
```

  证据: openSUSE Tumbleweed package metadata: cmake from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

### Windows

- Chocolatey (92%):

```sh
choco install cmake
```

  证据: Chocolatey community package catalog: cmake from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','cloudquery'

- Scoop (92%):

```sh
scoop install main/cmake
```

  证据: Scoop official bucket manifest trees: bucket/cmake.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

- winget (92%):

```sh
winget install --id Kitware.CMake -e
```

  证据: Windows Package Manager source index: Kitware.CMake from https://cdn.winget.microsoft.com/cache/source.msix

## 软件包事实

- **软件包键:** brew:cmake
- **软件包管理器:** Homebrew
- **版本:** 4.4.2
- **来源摘要:** Cross-platform make
- **主页:** <https://www.cmake.org/>
- **仓库:** <https://github.com/Kitware/CMake>
- **最后更新:** 2026-07-31T21:49:00Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- ccmake (别名)
- cmake (别名)
- cpack (别名)
- ctest (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 4.4.2
## 项目历史与用法

CMake is Kitware's cross-platform build, test, and package tooling family. It began as infrastructure for large portable C++ scientific software and became the de facto build-system interface for much of the C and C++ open source ecosystem.

### 项目历史

The official CMake history says CMake was created in 2000 for the National Library of Medicine's Insight Toolkit, after Bill Hoffman concluded that a new portable C++ build tool was needed. The early design goals were native build-tool support, one input file across platforms, bootstrap portability with only a C++ compiler, and code-generator support.

### 采用历史

CMake moved from ITK into VTK and ParaView in 2002, then into major open source projects over time. The official timeline highlights KDE switching in 2006, LLVM removing autoconf in favor of CMake in 2016, Visual Studio adding integrated CMake project support in 2017, and Qt switching to CMake in 2019. The CMake about page claims more than two million downloads per month, and the batch input lists packages across Homebrew, Debian, Fedora, Arch, Nix, MacPorts, Windows package managers, and more.

### 使用方式

The cmake executable generates project buildsystems, builds and installs projects, runs scripts, runs command-line helper actions, and exposes help. CMake projects begin from CMakeLists.txt files; modern workflows may also use CMakePresets.json and CMakeUserPresets.json, while generated build trees contain CMakeCache.txt.

### 为什么软件包爱好者会关心

CMake is package-nerd infrastructure: it is the build-system front door for thousands of upstream projects and distro recipes. Its generator model lets package maintainers target Make, Ninja, IDE projects, and platform-native tooling from the same upstream metadata, while CTest and CPack standardize test and packaging hooks.

### 时间线

- 2000: CMake is created for the National Library of Medicine's Insight Toolkit project.
- 2002: VTK and ParaView replace their build systems with CMake.
- 2006: KDE switches to CMake, helping drive Linux distribution availability.
- 2011: Ninja generator is added to CMake.
- 2016: LLVM switches to CMake and removes autoconf.
- 2017: Microsoft Visual Studio introduces integrated support for CMake projects.
- 2019: The Qt Group switches to CMake.
- 2020: CMake Presets are incorporated into Visual Studio and Ninja Multi-Config is added.
- 2022: CMake is publicly described as the standard build system in a C++Now talk cited by the official timeline.

### Related projects

- The official timeline ties CMake to ITK, VTK, ParaView, KDE, LLVM, Visual Studio, Qt, Ninja, CTest, CPack, and C++20 modules work. It is also the build dependency for projects such as cmark.

### 来源

- <https://cmake.org/history/>
- <https://cmake.org/about/>
- <https://cmake.org/cmake/help/latest/manual/cmake.1.html>
- <https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html>


## 安全说明

build system capable of executing project logic.

- **Geiger 风险:** yellow / 高
- build system capable of executing project logic
- **审批门规则:** 6


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: CMakePresets.json, CMakeUserPresets.json, <build-tree>/CMakeCache.txt
## 其他软件包管理器记录

- Debian apt - cmake - 3.31.6-2: normalized package name match | Debian stable package indexes: cmake from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | cross-platform, open-source make system | https://cmake.org/
- Debian apt - cmake-curses-gui - 3.31.6-2: normalized package name match | Debian stable package indexes: cmake-curses-gui from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | curses based user interface for CMake (ccmake) | https://cmake.org/
- Debian apt - cmake-data - 3.31.6-2: normalized package name match | Debian stable package indexes: cmake-data from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | CMake data files (modules, templates and documentation) | https://cmake.org/
- Debian apt - cmake-doc - 3.31.6-2: normalized package name match | Debian stable package indexes: cmake-doc from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | extended documentation in various formats for CMake | https://cmake.org/
- Debian apt - cmake-qt-gui - 3.31.6-2: normalized package name match | Debian stable package indexes: cmake-qt-gui from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Qt based user interface for CMake (cmake-gui) | https://cmake.org/
- Nix - cmake: normalized package name match | nixpkgs package indexes: pkgs/by-name/cm/cmake/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - cmake - 3.28.3-1build7: normalized package name match | Ubuntu 24.04 LTS package indexes: cmake from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | cross-platform, open-source make system | https://cmake.org/
- Ubuntu apt - cmake-curses-gui - 3.28.3-1build7: normalized package name match | Ubuntu 24.04 LTS package indexes: cmake-curses-gui from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | curses based user interface for CMake (ccmake) | https://cmake.org/
- Ubuntu apt - cmake-data - 3.28.3-1build7: normalized package name match | Ubuntu 24.04 LTS package indexes: cmake-data from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | CMake data files (modules, templates and documentation) | https://cmake.org/
- Ubuntu apt - cmake-doc - 3.28.3-1build7: normalized package name match | Ubuntu 24.04 LTS package indexes: cmake-doc from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | extended documentation in various formats for CMake | https://cmake.org/
- Ubuntu apt - cmake-qt-gui - 3.28.3-1build7: normalized package name match | Ubuntu 24.04 LTS package indexes: cmake-qt-gui from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | Qt based user interface for CMake (cmake-gui) | https://cmake.org/
- apk - ccmake - 4.3.4-r0: normalized package name match | Alpine Linux edge package indexes: ccmake from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Cross-platform, open-source make system (ccmake configurator) | https://cmake.org/
- apk - cmake - 4.3.4-r0: normalized package name match | Alpine Linux edge package indexes: cmake from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Cross-platform, open-source make system | https://cmake.org/
- apk - cmake-bash-completion - 4.3.4-r0: normalized package name match | Alpine Linux edge package indexes: cmake-bash-completion from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Bash completions for cmake | https://cmake.org/
- apk - cmake-doc - 4.3.4-r0: normalized package name match | Alpine Linux edge package indexes: cmake-doc from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Cross-platform, open-source make system (documentation) | https://cmake.org/
- apk - cmake-emacs - 4.3.4-r0: normalized package name match | Alpine Linux edge package indexes: cmake-emacs from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Cross-platform, open-source make system (emacs mode) | https://cmake.org/


## Combined YAML source

View the package source record on GitHub. [combined/cmake.yml](https://github.com/mxcl/pkgdb/blob/main/combined/cmake.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- approval-gate seed metadata
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
- curated agent safety answer
