# 使用 Homebrew, apk, apt, dnf, MacPorts, Nix, zypper 安装 coccinelle

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

## 安装

```sh
sudo av install brew:coccinelle
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install coccinelle
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install coccinelle
```

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

### Linux

- apk (92%):

```sh
sudo apk add coccinelle
```

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

- Debian apt (92%):

```sh
sudo apt install coccinelle
```

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

- dnf (92%):

```sh
sudo dnf install coccinelle
```

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

- Nix (92%):

```sh
nix profile install nixpkgs#coccinelle
```

  证据: nixpkgs package indexes: coccinelle from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix

- zypper (92%):

```sh
sudo zypper install coccinelle
```

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

## 软件包事实

- **软件包键:** brew:coccinelle
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/coccinelle>
- **版本:** 1.3.1
- **来源摘要:** Program matching and transformation engine for C code
- **主页:** <https://coccinelle.gitlabpages.inria.fr/website/>
- **仓库:** <https://gitlab.inria.fr/coccinelle/coccinelle>
- **上游文档:** <https://coccinelle.gitlabpages.inria.fr/website>
- **许可证:** GPL-2.0-only
- **源码归档:** <https://coccinelle.gitlabpages.inria.fr/website/distrib/coccinelle-1.3.1.tar.gz>
- **已生成:** 2026-07-08T07:18:31+00:00

## 可执行文件

- spatch (cli)
- spgen (cli)
- spatch (别名)
- spgen (别名)

## 构建依赖

- autoconf
- automake
- menhir
- ocaml
- ocaml-findlib

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## 版本和新鲜度

- 页面生成时间: 2026-07-08
- 管理器版本: 1.3.1
- 本地数据: OK
- 上游仓库: https://coccinelle.gitlabpages.inria.fr/website/
- 信息: No package-manager update timestamp was available.
- 信息: Release/tag comparison is only available for GitHub repositories.
## 项目历史与用法

Coccinelle is a program matching and transformation engine for C code, centered on SmPL, the Semantic Patch Language. In package-manager culture it is best known as the `spatch` tool used for large C tree transformations, especially in Linux kernel development.

### 项目历史

The official INRIA site describes Coccinelle as a tool originally targeted at collateral evolutions in Linux: source-code updates required when library APIs change. It broadened from that origin into finding and fixing bugs in systems code.

The project has long had a research and systems-programming identity. The official site links papers, workshops, Linux impact pages, and SmPL grammar documentation, while the current GitLab project is hosted under INRIA.

### 采用历史

Coccinelle's strongest adoption signal is Linux itself. The upstream Linux documentation has a dedicated Coccinelle page, describes the `make coccicheck` target, and says the semantic patches in the kernel require Coccinelle 1.0.0-rc11 or newer.

The Linux documentation also lists distribution availability through Debian, Fedora, Ubuntu, OpenSUSE, Arch Linux, Gentoo, NetBSD, and FreeBSD, while the input adds Homebrew, MacPorts, Nix, apk, dnf, and zypper.

### 使用方式

The main executable is `spatch`. Users write semantic patches in SmPL and run them over a file, directory, or source tree to report matches or propose transformations.

In the Linux kernel workflow, `make coccicheck MODE=report` reports matches and `MODE=patch` proposes fixes. The kernel script wires Coccinelle into the build tree through `scripts/coccicheck` and `scripts/coccinelle`.

Coccinelle supports `.cocciconfig` files in the user's home directory, the current directory, and the directory passed with `--dir`, letting users set preferred `spatch` options.

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

Coccinelle is one of the more historically interesting developer-tool packages because it turns program transformation research into a packaged Unix CLI used by real infrastructure projects.

For package maintainers, it is a cross-distribution systems-code tool with an OCaml heritage, a Linux-kernel integration point, and a command (`spatch`) whose usefulness depends on both the executable and a corpus of semantic patches.

### 时间线

- 2005: Official site HTML carries an early creation marker.
- 2009: Official site lists the first Coccinelle Users Day.
- 2010: Linux kernel Coccinelle documentation and coccicheck script carry 2010 copyright notices.
- 2010: Official site links Coccinelle at the 2010 kernel summit.
- 2020: Current INRIA GitLab project created.
- 2021: SmPL grammar documentation lists version 1.1.0 and date June 21, 2021.

### Related projects

- Linux kernel `coccicheck` is the most visible related integration.
- SmPL is the project-specific semantic patch language.
- The Rust-for-Linux Coccinelle-for-Rust work is linked from the official site as a related direction.

### 来源

- <https://coccinelle.gitlabpages.inria.fr/website/>
- <https://coccinelle.gitlabpages.inria.fr/website/docs/index.html>
- <https://coccinelle.gitlabpages.inria.fr/website/docs/main_grammar015.html>
- <https://coccinelle.gitlabpages.inria.fr/website/impact_linux.html>
- <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/Documentation/dev-tools/coccinelle.rst>
- <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/scripts/coccicheck>


## 安全说明

narrow executable package without higher-risk signals.

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


## 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: ~/.cocciconfig, ./.cocciconfig, <dir passed with --dir>/.cocciconfig
## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** coccinelle
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

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

- Debian apt - coccinelle - 1.3.0.deb-1+b2: normalized package name match | Debian stable package indexes: coccinelle from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | semantic patching tool for C | http://coccinelle.lip6.fr
- Nix - coccinelle: normalized package name match | nixpkgs package indexes: coccinelle from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix
- Ubuntu apt - coccinelle - 1.1.1.deb-5build1: normalized package name match | Ubuntu 24.04 LTS package indexes: coccinelle from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | semantic patching tool for C | http://coccinelle.lip6.fr
- Ubuntu apt - coccinelle-doc - 1.1.1.deb-5build1: normalized package name match | Ubuntu 24.04 LTS package indexes: coccinelle-doc from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | documentation for coccinelle | http://coccinelle.lip6.fr
- apk - coccinelle - 1.1.1-r2: normalized package name match | Alpine Linux edge package indexes: coccinelle from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | provides the spatch matching and transformation engine implementing semantic patch language | https://coccinelle.gitlabpages.inria.fr/website/
- apk - coccinelle-bash-completion - 1.1.1-r2: normalized package name match | Alpine Linux edge package indexes: coccinelle-bash-completion from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | Bash completions for coccinelle | https://coccinelle.gitlabpages.inria.fr/website/
- apk - coccinelle-doc - 1.1.1-r2: normalized package name match | Alpine Linux edge package indexes: coccinelle-doc from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | provides the spatch matching and transformation engine implementing semantic patch language (documentation) | https://coccinelle.gitlabpages.inria.fr/website/
- dnf - coccinelle - 1.3.1-7.fc45: normalized package name match | Fedora Rawhide package metadata: coccinelle from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | Semantic patching for Linux (spatch) | https://coccinelle.lip6.fr/
- dnf - coccinelle-bash-completion - 1.3.1-7.fc45: normalized package name match | Fedora Rawhide package metadata: coccinelle-bash-completion from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | Bash tab-completion for coccinelle | https://coccinelle.lip6.fr/
- dnf - coccinelle-doc - 1.3.1-7.fc45: normalized package name match | Fedora Rawhide package metadata: coccinelle-doc from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | Documentation for coccinelle | https://coccinelle.lip6.fr/
- dnf - coccinelle-examples - 1.3.1-7.fc45: normalized package name match | Fedora Rawhide package metadata: coccinelle-examples from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | Examples for coccinelle | https://coccinelle.lip6.fr/
- zypper - coccinelle - 1.3.1-2.3: normalized package name match | openSUSE Tumbleweed package metadata: coccinelle from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | Semantic patch utility | http://coccinelle.lip6.fr/
- MacPorts - coccinelle: normalized package name match | MacPorts ports tree: devel/coccinelle/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## 相关链接

- [Terminal utility packages](https://www.automicvault.com/zh-hans/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://www.automicvault.com/zh-hans/pkg/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://www.automicvault.com/zh-hans/pkg/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [Networking and protocol packages](https://www.automicvault.com/zh-hans/pkg/networking-protocol-tools/) - Matched network, protocol, or remote-service metadata.
- [autoconf](https://www.automicvault.com/zh-hans/pkg/brew/autoconf/) - Build dependency declared by Homebrew.
- [automake](https://www.automicvault.com/zh-hans/pkg/brew/automake/) - Build dependency declared by Homebrew.
- [menhir](https://www.automicvault.com/zh-hans/pkg/brew/menhir/) - Build dependency declared by Homebrew.
- [ocaml](https://www.automicvault.com/zh-hans/pkg/brew/ocaml/) - Build dependency declared by Homebrew.
- [darklua](https://www.automicvault.com/zh-hans/pkg/brew/darklua/) - Shares av.db curated category or tags: cli, code-transformation, developer-tools.
- [cbmc](https://www.automicvault.com/zh-hans/pkg/brew/cbmc/) - Shares av.db curated category or tags: c, cli, developer-tools, static-analysis.
- [ccheck](https://www.automicvault.com/zh-hans/pkg/brew/ccheck/) - Shares av.db curated category or tags: c, cli, developer-tools, static-analysis.
- [cflow](https://www.automicvault.com/zh-hans/pkg/brew/cflow/) - Shares av.db curated category or tags: c, cli, developer-tools, static-analysis.
- [comby](https://www.automicvault.com/zh-hans/pkg/brew/comby/) - Shares av.db curated category or tags: cli, code-transformation, developer-tools.
- [cppcheck](https://www.automicvault.com/zh-hans/pkg/brew/cppcheck/) - Shares av.db curated category or tags: c, cli, developer-tools, static-analysis.
- [deheader](https://www.automicvault.com/zh-hans/pkg/brew/deheader/) - Shares av.db curated category or tags: c, cli, developer-tools, static-analysis.
- [gnu-complexity](https://www.automicvault.com/zh-hans/pkg/brew/gnu-complexity/) - Shares av.db curated category or tags: c, cli, developer-tools, static-analysis.
- [sparse](https://www.automicvault.com/zh-hans/pkg/brew/sparse/) - Local package facts share a topical domain. Shared terms: analysis, c, cli, code, developer.

## Combined YAML source

View the package source record on GitHub. [combined/coccinelle.yml](https://github.com/automic-vault/db/blob/main/combined/coccinelle.yml)


## 来源

- Nucleus package database
- Geiger risk classifier
- package-page enrichment
- curated configuration and credential file locations
- curated package history
- package version freshness
- av.db category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
