# Install gnu-complexity with Homebrew, apt, Nix, zypper

Measures complexity of C source. Version 1.13 via Homebrew; verified from local package data.

## Install

```sh
sudo av install brew:gnu-complexity
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install gnu-complexity
```

  Evidence: local Homebrew formula metadata

### Linux

- Debian apt (92%):

```sh
sudo apt install complexity
```

  Evidence: Debian stable package indexes: complexity from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- Nix (92%):

```sh
nix profile install nixpkgs#complexity
```

  Evidence: nixpkgs package indexes: pkgs/by-name/co/complexity/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- zypper (92%):

```sh
sudo zypper install complexity
```

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

## Package facts

- **Package key:** brew:gnu-complexity
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/gnu-complexity>
- **Version:** 1.13
- **Source summary:** Measures complexity of C source
- **Homepage:** <https://www.gnu.org/software/complexity/>
- **Repository:** <https://git.savannah.gnu.org/cgit/complexity.git>
- **Upstream docs:** <https://www.gnu.org/software/complexity/manual>
- **License:** GPL-3.0-or-later
- **Source archive:** <https://ftpmirror.gnu.org/gnu/complexity/complexity-1.13.tar.xz>
- **Generated:** 2026-07-08T07:18:31+00:00

## Executables

- complexity (cli)
- cx-vs-mc (cli)
- complexity (alias)
- cx-vs-mc (alias)

## Dependencies

- autogen

## Build dependencies

- autoconf
- automake

## Install behavior

- Post-install hook: not defined
- Bottle: available on arm64_big_sur, arm64_linux, arm64_monterey, arm64_sequoia, arm64_sonoma, arm64_tahoe, arm64_ventura, big_sur, monterey, sonoma, ventura, x86_64_linux

## Freshness

- Page generated: 2026-07-08
- Package-manager version: 1.13
- Local data: ok
- Upstream repository: https://www.gnu.org/software/complexity/
- info: No package-manager update timestamp was available.
- info: Release/tag comparison is only available for GitHub repositories.
## Project history and usage

GNU Complexity is a small GNU static-analysis tool for measuring the complexity of C functions, designed as a more human-comprehension-oriented alternative to simple McCabe-style path counts.

### Project history

The GNU Complexity manual documents version 0.4 as of May 2011 and describes a tool by Bruce Korb for analyzing C function complexity. Its rationale is explicit: McCabe-style scoring and `pmccabe` are useful for testing effort, but GNU Complexity tries to better rank functions that are difficult for humans to understand by considering length, nesting, switch bodies, and complicated boolean expressions.

### Adoption history

GNU Complexity has a narrow adoption footprint compared with larger GNU developer tools. Its significance is in the code-review and maintenance niche: it gives C maintainers a command-line metric that can point to suspicious functions in unfamiliar code, estimate testing or comprehension effort, and produce sorted score tables and histograms.

### How it is used

Practitioners run `complexity` over C source files to report procedure scores, line counts, source locations, and optional histograms. The manual's example runs the tool against its own source with a low threshold, illustrating use as a quick audit tool for ranking functions before refactoring or review.

### Why package nerds care

For package nerds, GNU Complexity is interesting because it embodies a Unix-tool approach to maintainability: one command, text output, tunable thresholds, and a documented scoring model. It is useful in distributions as a lightweight companion to older tools such as `pmccabe` rather than as a large static-analysis framework.

### Timeline

- 2011: GNU Complexity web page and manual documented version 0.4.
- 2011: Manual rationale compared GNU Complexity with `pmccabe` and explained its scoring model.

### Related projects

- `pmccabe` is the comparison point used throughout the GNU Complexity manual.
- `unifdef` is discussed in the parsing model as a way to handle preprocessor-conditional source.

### Sources

- <https://www.gnu.org/software/complexity/>
- <https://www.gnu.org/software/complexity/manual/complexity.html>


## Security Notes

narrow executable package without higher-risk signals.

- **Geiger risk:** green / low
- narrow executable package without higher-risk signals

## Source Database Details

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

## Other Package-Manager Records

- Debian apt - complexity - 1.13-1+b1: installed executable or alias match | Debian stable package indexes: complexity from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | tool for analyzing the complexity of C program functions | https://gnu.org/software/complexity
- Debian apt - complexity-doc - 1.13-1: installed executable or alias match | Debian stable package indexes: complexity-doc from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | tool for analyzing the complexity of C program (documentation) | https://gnu.org/software/complexity
- Nix - complexity: installed executable or alias match | nixpkgs package indexes: pkgs/by-name/co/complexity/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - complexity - 1.13-1: installed executable or alias match | Ubuntu 24.04 LTS package indexes: complexity from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | tool for analyzing the complexity of C program functions | https://gnu.org/software/complexity
- Ubuntu apt - complexity-doc - 1.13-1: installed executable or alias match | Ubuntu 24.04 LTS package indexes: complexity-doc from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | tool for analyzing the complexity of C program (documentation) | https://gnu.org/software/complexity
- zypper - complexity - 1.13-1.7: installed executable or alias match | openSUSE Tumbleweed package metadata: complexity from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | C source code complexity computation utility | https://www.gnu.org/software/complexity/


## Related links

- [Terminal utility packages](https://www.automicvault.com/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://www.automicvault.com/pkg/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://www.automicvault.com/pkg/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [Networking and protocol packages](https://www.automicvault.com/pkg/networking-protocol-tools/) - Matched network, protocol, or remote-service metadata.
- [autogen](https://www.automicvault.com/pkg/brew/autogen/) - Runtime dependency declared by Homebrew.
- [autoconf](https://www.automicvault.com/pkg/brew/autoconf/) - Build dependency declared by Homebrew.
- [automake](https://www.automicvault.com/pkg/brew/automake/) - Build dependency declared by Homebrew.
- [lizard-analyzer](https://www.automicvault.com/pkg/brew/lizard-analyzer/) - Shares av.db curated category or tags: cli, code-analysis, code-metrics, developer-tools, metrics.
- [gocloc](https://www.automicvault.com/pkg/brew/gocloc/) - Shares av.db curated category or tags: cli, code-analysis, code-metrics, developer-tools, metrics.
- [pmccabe](https://www.automicvault.com/pkg/brew/pmccabe/) - Shares av.db curated category or tags: c, cli, code-analysis, code-metrics, developer-tools.
- [ccheck](https://www.automicvault.com/pkg/brew/ccheck/) - Shares av.db curated category or tags: c, cli, code-analysis, developer-tools, static-analysis.
- [include-what-you-use](https://www.automicvault.com/pkg/brew/include-what-you-use/) - Shares av.db curated category or tags: c, cli, code-analysis, developer-tools, static-analysis.
- [ohcount](https://www.automicvault.com/pkg/brew/ohcount/) - Shares av.db curated category or tags: cli, code-analysis, developer-tools, metrics.
- [castxml](https://www.automicvault.com/pkg/brew/castxml/) - Shares av.db curated category or tags: c, cli, code-analysis, developer-tools.
- [tokei](https://www.automicvault.com/pkg/brew/tokei/) - Shares av.db curated category or tags: cli, code-analysis, code-metrics, developer-tools.
- [cflow](https://www.automicvault.com/pkg/brew/cflow/) - Local package facts share a topical domain. Shared terms: analysis, c, cli, code, developer.
- [gnu-indent](https://www.automicvault.com/pkg/brew/gnu-indent/) - Package names and metadata indicate a similar tool family. Shared terms: c, cli, code, developer, developer-tools.
- [gnu-barcode](https://www.automicvault.com/pkg/brew/gnu-barcode/) - Package names and metadata indicate a similar tool family. Shared terms: cli, developer, developer-tools, gnu.

## Combined YAML source

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


## Sources

- Nucleus package database
- Geiger risk classifier
- package-page enrichment
- 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
