
Coccinelle
Coccinelle is a free program matching and transformation engine for C code, available for Linux and macOS.
What Coccinelle is
Coccinelle is a free program matching and transformation engine for C code, available for Linux and macOS. It uses SmPL to describe code patterns and the changes to apply when they match. A semantic patch can modify code across hundreds of files and thousands of sites while allowing for differences in spacing, variable names, irrelevant code, and coding style. The project describes using Coccinelle to automate code changes after library API evolution and to find and fix bugs in systems code. Its semantic patches and bug fixes have been integrated into the official Linux tree, and semantic patches are also available in the Linux scripts directory for use with coccicheck. The project supports C and C++, with C++ mode invoked using --c++; it says C++ support is being extended, including for high performance computing. The download page lists version 1.3.3, dated September 2, 2026, with source code and precompiled spatch builds. Documentation includes spatch options, an annotated SmPL grammar, examples, and an introductory lecture. Building from source requires OCaml, with Python and Menhir needed in certain circumstances.
Good
- Free to use on Linux and macOS.
- Semantic patches can change many code sites.
- Supports repository-wide batch refactoring.
- Includes documentation, examples, and an introductory lecture.
- Precompiled spatch builds are available.
Watch out
- Source builds require OCaml.
- Python and Menhir are required in some build situations.
- Platforms listed are limited to Linux and macOS.
Who it suits
Coccinelle suits developers working on C code who need repository-wide transformations or help finding and fixing systems-code bugs. It also offers C++ mode for projects using that language.
Verdict
Coccinelle is a specialized option for describing and applying structured changes across C codebases. Its SmPL approach and Linux integration may be useful for large-scale maintenance tasks.
Plans and prices
From Coccinelle's own pricing page, checked 5 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| Coccinelle | Free | No paid plan information stated on the official site |
The facts
Each one read from Coccinelle's own pages, with the date it was checked.
What it does
- Build requirements
- Building from source requires OCaml, optionally Python 2.5–2.7 or Python 3, and Menhir when modifying the SmPL grammar or after make distclean.checked 5 Oct 2026
- C++ and HPC
- The project says Coccinelle is being extended for C++ code, with high performance computing as an application area, and C++ mode is invoked with --c++.checked 5 Oct 2026
- Documentation
- The project provides spatch option documentation, an SmPL grammar document with annotated examples, additional examples, and an introductory lecture.checked 5 Oct 2026
- Download
- The official download page lists version 1.3.3, dated September 2, 2026, and provides source code and precompiled spatch builds.checked 5 Oct 2026
- Maintainers
- The project lists Julia Lawall, Victor Gambier, Michele Martone, and Tathagata Roy as people currently working on Coccinelle.checked 5 Oct 2026
- Purpose
- Coccinelle is a program matching and transformation engine that uses SmPL to specify desired matches and transformations in C code.checked 5 Oct 2026
- Security
- The official pages opened for this research do not state security certifications, compliance claims, or a security program.checked 5 Oct 2026
- Semantic patches
- A single semantic patch can modify hundreds of files at thousands of code sites while abstracting over spacing, variable names, irrelevant code, and coding style.checked 5 Oct 2026
- Support
- Questions can be sent to the [email protected] mailing list, which is moderated for non-members; contributions are preferred via the list and may also be submitted on GitHub.checked 5 Oct 2026
- Use cases
- The project describes use for automating collateral code changes after library API evolution and for finding and fixing bugs in systems code.checked 5 Oct 2026
Where it runs
- Linux integration
- Coccinelle semantic patches are available in the Linux scripts directory, and coccicheck scripts can apply multiple SmPL files to one project.checked 5 Oct 2026
- Linux kernel
- The project lists semantic patch changes and bug fixes that have been integrated into the official Linux tree.checked 5 Oct 2026
- Platforms
- The download page provides packages for several Linux distributions and says Coccinelle can be installed with brew on Linux and macOS.checked 5 Oct 2026
The full review of Coccinelle
Coccinelle is a semantic-patch engine for describing and applying structural changes in C repositories. It suits maintainers handling broad API migrations or recurring systems-code defects; its focused, language-driven workflow is less appropriate for teams wanting a general refactoring IDE.
Overview
Coccinelle uses the SmPL language to define both the code pattern to match and the transformation to perform. One semantic patch can reach hundreds of files and thousands of sites while tolerating differences in whitespace, variable names, unrelated statements, and coding style. In practice, that makes a carefully written patch far more reusable than a literal search-and-replace when a library interface changes across a large codebase.
The same model supports bug-finding and corrective edits in systems code. The project cites semantic-patch changes and fixes merged into the official Linux tree, a meaningful indication of where the tool fits: long-lived, repository-scale C maintenance rather than occasional file-level cleanup.
Key features
SmPL semantic patches
SmPL expresses intent at the level of C structure, so a rule can cover many stylistic and naming variations. That is the central strength for batch refactoring, but it also sets the learning requirement: users must formulate matching and transformation rules precisely and review the resulting edits rather than treating the tool as a blind replacement engine.
Linux-oriented workflows
Semantic patches are included in the Linux scripts directory, and coccicheck can apply multiple SmPL files to one project. Kernel contributors therefore get a workflow aligned with an established codebase and a library of relevant patches. Developers outside that ecosystem can still use the engine, but they will need to build their own rules and process around it.
Documentation and extensibility
The project provides spatch option documentation, an SmPL grammar reference with annotated examples, further examples, and an introductory lecture. Coccinelle is also being extended for C++ and identifies high-performance computing as an application area; C++ mode is invoked with --c++. Those resources help experienced developers get started, while the grammar-focused approach remains more specialized than conventional editor refactoring.
Pricing
Coccinelle is free, with the Coccinelle plan listed as free. There is no paid tier or free trial. This removes licensing cost for repository-wide maintenance, but it also means organizations should budget their own engineering time for learning SmPL, reviewing transformations, and integrating the command-line workflow.
Platforms
The desktop application supports Linux and macOS. The official download page lists version 1.3.3, dated September 2, 2026, with source code and precompiled spatch builds. Building from source requires OCaml; Python 2.5–2.7 or Python 3 is optional, and Menhir is needed when changing the SmPL grammar or after make distclean. These requirements favor developers comfortable with Unix toolchains over users seeking a packaged graphical utility.
Who it's for
Coccinelle is a strong fit for C maintainers coordinating an API migration, enforcing a structural correction across a repository, or locating and fixing repeated systems-code bugs. Kernel work is especially well served by its existing scripts and coccicheck integration. It is a weaker choice for small projects, occasional edits, or teams that need visual, language-server-driven refactoring across many languages; the supported languages are C and C++, and the scope is repository-level batch work.
Pros and cons
Pros
- High-leverage transformations: one SmPL patch can update thousands of sites while ignoring superficial formatting and naming differences.
- Proven kernel relevance: patches and bug fixes have reached the official Linux tree, and Linux supplies scripts for applying them.
- No license charge: the complete offering is free, with no paid-plan restriction.
- Useful learning material: grammar documentation, examples, options reference, and an introductory lecture support adoption.
Cons
- Specialized language: effective use depends on learning SmPL and expressing match conditions accurately.
- Narrow language coverage: the tool targets C, with C++ support described as an extension rather than a broad multi-language refactoring platform.
- Build complexity: source builds involve OCaml and, for some workflows, Python and Menhir.
- Desktop, command-oriented deployment: it does not present a GUI-led workflow for teams seeking interactive refactoring.
Alternatives
Code Refactoring Tools is the broader category guide for comparing approaches. Choose ast-grep instead when you need Linux, macOS, Windows, web, API, or extension deployment. CodeRush suits users wanting an extension with all versions free for commercial use and the same features and updates across subscriptions. ReSharper is the freemium option when a trial and non-commercial C# support in VS Code or compatible editors matter. Roslynator provides free tools and extensions, with donations welcome. OpenRewrite is preferable for Apache-licensed recipes running one repository at a time on Linux or self-hosted systems. CodART is an MIT-licensed alternative across API, web, Linux, and self-hosted deployments, although SciTools Understand requires a separate professional license. Sourcery targets public repositories with AI reviews, summaries, diagrams, one-click fixes, and custom rules on its free Open Source plan. Spoon is a free, open-source API option with no paid plans or usage limits stated.
Verdict
Choose Coccinelle if you maintain substantial C code and need one precise, style-tolerant transformation to propagate across a repository at no licensing cost. Its SmPL engine and Linux integration are the main reasons to adopt it. Look elsewhere if you need broad language coverage, an interactive IDE experience, or a simpler path than learning and validating semantic patches.
Alternatives to Coccinelle
- 1

Sourcery
Free planWebAPIExtensionLinux7.9From $12 a month - 2

Moderne
WebAPILinuxmacOS7.3From $2,000 a month - 3

ast-grep
Free planWebAPIExtensionLinux7.0Free plan - 4

ReSharper
Free planExtensionLinuxmacOSWindows6.8From $389 a year - 5
jSparrow
LinuxmacOSWindows6.4From $1,325 a year - 6

CodeRush
Free planExtensionLinuxmacOSWindows6.3Free plan
