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

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

## 安装

```sh
sudo av install brew:cppcheck
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install cppcheck
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install cppcheck
```

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

### Linux

- apk (92%):

```sh
sudo apk add cppcheck
```

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

- Debian apt (92%):

```sh
sudo apt install cppcheck
```

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

- dnf (92%):

```sh
sudo dnf install cppcheck
```

  证据: Fedora Rawhide package metadata: cppcheck 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#cppcheck
```

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

- pacman (92%):

```sh
sudo pacman -S cppcheck
```

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

- zypper (92%):

```sh
sudo zypper install cppcheck
```

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

### Windows

- Chocolatey (92%):

```sh
choco install cppcheck
```

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

- Scoop (92%):

```sh
scoop install main/cppcheck
```

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

- winget (92%):

```sh
winget install --id Cppcheck.Cppcheck -e
```

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

## 软件包事实

- **软件包键:** brew:cppcheck
- **软件包管理器:** Homebrew
- **版本:** 2.21.0
- **来源摘要:** Static analysis of C and C++ code
- **主页:** <https://sourceforge.net/projects/cppcheck/>
- **仓库:** <https://github.com/cppcheck-opensource/cppcheck>
- **最后更新:** 2026-07-05T00:14:30+09:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- cppcheck (别名)
- cppcheck-htmlreport (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

Cppcheck is an open-source static analysis tool for C and C++ code. It focuses on bugs that compilers commonly miss, especially undefined behavior and dangerous constructs, while trying to keep false positives low.

### 项目历史

The upstream README notes that the original name was C++check and was later changed to Cppcheck. It also says that despite the name, Cppcheck is designed for both C and C++.

The GitHub repository was created in March 2009. The README states that the repository moved from danmar/cppcheck to cppcheck-opensource/cppcheck, and the official website now links current source downloads to the cppcheck-opensource GitHub releases.

Cppcheck has kept both command-line and graphical user interfaces. Upstream build documentation covers CMake, Visual Studio, Qt Creator, GNU make, MinGW, and cross-compiling, which explains why it appears in many OS package ecosystems.

### 采用历史

The supplied package facts list Cppcheck across Homebrew, MacPorts, Debian, Ubuntu, Fedora/dnf, Alpine/apk, Arch/pacman, Nix, openSUSE/zypper, Chocolatey, Scoop, winget, and more. Upstream's README also explicitly points users to Homebrew, MacPorts, Conda, Conan, and other distribution channels, while warning that third-party packages may lag releases.

The official website lists integrations with development tools such as Buildbot, CLion, Code::Blocks, CodeLite, Eclipse, and others. That integration footprint is part of why Cppcheck is common in CI and editor workflows.

### 使用方式

Cppcheck is used from the command line and GUI to analyze C/C++ projects for memory issues, out-of-bounds access, uninitialized variables, null dereferences, invalid shifts, integer overflows, and other undefined behavior. Upstream also documents addon, rules, and platform data files as part of packaged installs.

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

Cppcheck is package-significant because static analyzers are often installed as developer tools rather than vendored into one project. Packagers need to track release cadence, optional PCRE/rules support, GUI builds, data-file install paths, and the upstream repository move while preserving a stable cppcheck command for CI.

### 时间线

- 2009: Public GitHub repository created.
- 2025: The upstream README documents the repository move to cppcheck-opensource/cppcheck.
- 2026: Official releases include Cppcheck 2.21.0.

### Related projects

- Cppcheck Premium is the upstream commercial offering with additional checks and support.
- The official website lists editor and CI integrations, including Buildbot, CLion, Code::Blocks, CodeLite, and Eclipse.

### 来源

- <https://api.github.com/repos/cppcheck-opensource/cppcheck>
- <https://raw.githubusercontent.com/danmar/cppcheck/main/readme.md>
- <https://cppcheck.sourceforge.io/>
- <https://api.github.com/repos/cppcheck-opensource/cppcheck/releases?per_page=5>
- <https://sourceforge.net/projects/cppcheck/rss?path=/cppcheck>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals

## 其他软件包管理器记录

- Debian apt - cppcheck - 2.17.1-2: normalized package name match | Debian stable package indexes: cppcheck from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | tool for static C/C++ code analysis (CLI) | https://sourceforge.net/p/cppcheck/wiki/Home/
- Debian apt - cppcheck-gui - 2.17.1-2: normalized package name match | Debian stable package indexes: cppcheck-gui from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | tool for static C/C++ code analysis (GUI) | https://sourceforge.net/p/cppcheck/wiki/Home/
- Nix - cppcheck: normalized package name match | nixpkgs package indexes: pkgs/by-name/cp/cppcheck/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - cppcheck - 2.13.0-2ubuntu3: normalized package name match | Ubuntu 24.04 LTS package indexes: cppcheck from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | tool for static C/C++ code analysis (CLI) | https://sourceforge.net/p/cppcheck/wiki/Home/
- Ubuntu apt - cppcheck-gui - 2.13.0-2ubuntu3: normalized package name match | Ubuntu 24.04 LTS package indexes: cppcheck-gui from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | tool for static C/C++ code analysis (GUI) | https://sourceforge.net/p/cppcheck/wiki/Home/
- apk - cppcheck - 2.21.0-r0: normalized package name match | Alpine Linux edge package indexes: cppcheck from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Static analysis tool for C/C++ code | https://cppcheck.sourceforge.io/
- apk - cppcheck-doc - 2.21.0-r0: normalized package name match | Alpine Linux edge package indexes: cppcheck-doc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Static analysis tool for C/C++ code (documentation) | https://cppcheck.sourceforge.io/
- apk - cppcheck-gui - 2.21.0-r0: normalized package name match | Alpine Linux edge package indexes: cppcheck-gui from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Qt gui for cppcheck | https://cppcheck.sourceforge.io/
- apk - cppcheck-htmlreport - 2.21.0-r0: normalized package name match | Alpine Linux edge package indexes: cppcheck-htmlreport from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Utility to generate a html report of a XML file produced by cppcheck | https://cppcheck.sourceforge.io/
- dnf - cppcheck - 2.21.1-2.fc45: normalized package name match | Fedora Rawhide package metadata: cppcheck from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Tool for static C/C++ code analysis | http://cppcheck.sourceforge.io/
- dnf - cppcheck-gui - 2.21.1-2.fc45: normalized package name match | Fedora Rawhide package metadata: cppcheck-gui from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Graphical user interface for cppcheck | http://cppcheck.sourceforge.io/
- dnf - cppcheck-htmlreport - 2.21.1-2.fc45: normalized package name match | Fedora Rawhide package metadata: cppcheck-htmlreport from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | HTML reporting for cppcheck | http://cppcheck.sourceforge.io/
- pacman - cppcheck - 2.21.1-1: normalized package name match | Arch Linux sync databases: cppcheck from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | A tool for static C/C++ code analysis | http://cppcheck.sourceforge.net/
- zypper - cppcheck - 2.21.0-1.3: normalized package name match | openSUSE Tumbleweed package metadata: cppcheck from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | A tool for static C/C++ code analysis | https://github.com/cppcheck-opensource/cppcheck
- zypper - cppcheck-gui - 2.21.0-1.3: normalized package name match | openSUSE Tumbleweed package metadata: cppcheck-gui from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | A tool for static C/C++ code analysis | https://github.com/cppcheck-opensource/cppcheck
- MacPorts - cppcheck: normalized package name match | MacPorts ports tree: devel/cppcheck/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## Combined YAML source

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


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
