# Install cloc with Homebrew, apk, chocolatey, apt, dnf, MacPorts, Nix, pacman, scoop, winget

Statistics utility to count lines of code. Version 2.10 via Homebrew; verified 2026-07-04.

## Install

```sh
sudo av install brew:cloc
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install cloc
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install cloc
```

  Evidence: MacPorts ports tree: textproc/cloc/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add cloc
```

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

- Debian apt (92%):

```sh
sudo apt install cloc
```

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

- dnf (92%):

```sh
sudo dnf install cloc
```

  Evidence: Fedora Rawhide package metadata: cloc 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#cloc
```

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

- pacman (92%):

```sh
sudo pacman -S cloc
```

  Evidence: Arch Linux sync databases: cloc from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

### Windows

- Chocolatey (92%):

```sh
choco install CLOC
```

  Evidence: Chocolatey community package catalog: CLOC from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','chocolatey-preinstaller-checks.extension'

- Scoop (92%):

```sh
scoop install main/cloc
```

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

- winget (92%):

```sh
winget install --id AlDanial.Cloc -e
```

  Evidence: Windows Package Manager source index: AlDanial.Cloc from https://cdn.winget.microsoft.com/cache/source.msix

## Package facts

- **Package key:** brew:cloc
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/cloc>
- **Version:** 2.10
- **Source summary:** Statistics utility to count lines of code
- **Homepage:** <https://github.com/AlDanial/cloc/>
- **Repository:** <https://github.com/AlDanial/cloc>
- **Upstream docs:** <https://github.com/AlDanial/cloc#readme>
- **License:** GPL-2.0-or-later
- **Source archive:** <https://github.com/AlDanial/cloc/archive/refs/tags/v2.10.tar.gz>
- **Last updated:** 2026-07-04T23:36:10Z
- **Generated:** 2026-07-08T18:08:21+00:00

## Executables

- cloc (cli)
- cloc (alias)

## Uses from macOS

- perl

## Install behavior

- Post-install hook: not defined
- Bottle: available on arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## Freshness

- Page generated: 2026-07-08
- Package-manager version: 2.10
- Package-manager updated: 2026-07-04
- Local data: ok
- Upstream repository: https://github.com/AlDanial/cloc
- Upstream latest detected: v2.10 (current)
## Project history and usage

cloc counts blank lines, comment lines, and physical source lines across many programming languages, with support for files, directories, archives, repositories, and diffs.

### Project history

cloc was created by Al Danial and dates to 2006, when the project was hosted on SourceForge. The official README states that cloc moved to GitHub in September 2015 after SourceForge hosting that began in August 2006.

The tool is written in Perl, is designed to be portable with few external requirements, and incorporates ideas or code from SLOCCount, Regexp::Common, Win32::Autoglob, and Algorithm::Diff. Release notes show steady additions of language recognizers, output formats, archive support, VCS/diff features, and Windows packaging improvements.

### Adoption history

cloc became a staple packaging target because it is useful in almost any source tree and easy to ship as a command-line utility. The official README documents installation through npm, apt, yum, dnf, pacman, emerge, apk, pkg, pkg_add, MacPorts, Homebrew, winget, Chocolatey, Scoop, Docker, and GitHub releases.

The batch input independently records coverage across Alpine, Homebrew, Chocolatey, Debian, Fedora, MacPorts, Nix, Arch, Scoop, Ubuntu, and Winget, matching cloc's broad cross-platform adoption.

### How it is used

Users run `cloc` on a file, directory, archive, git commit, or repository to get language-level blank/comment/code counts. It can also compare versions, read archives such as tar, zip, wheels, RPMs, and Debian packages, and emit reports in multiple formats.

Because the source version runs on Perl and the Windows executable bundles what it needs, cloc is practical for CI jobs, release audits, quick repository comparisons, and language-mix summaries.

### Why package nerds care

cloc is package-nerd significant because it is one of the standard tiny tools people install everywhere to inspect source distributions. It also tests package metadata assumptions: source archives, generated Windows binaries, shell wrappers, Perl availability, Docker images, CPAN/npm wrappers, and OS-native packages all coexist.

Its README explicitly credits maintainers for Debian, CPAN, and npm packaging, showing that cloc's distribution story is not incidental but part of its ecosystem.

### Timeline

- 2006: SourceForge hosting begins and Al Danial copyright history starts.
- 2015: Project moves from SourceForge to GitHub.
- 2021: cloc receives a Zenodo DOI badge in upstream metadata.
- 2024: Version 2.00 released with no breaking changes from 1.x.
- 2025: Version 2.06 uses GitHub Actions for release packaging and Windows executable work.
- 2026: Version 2.08 released with additional language/file-type support and packaging refinements.

### Related projects

- Related projects include David Wheeler's SLOCCount, Git, Docker, Perl packaging ecosystems, App::cloc on CPAN, the npm cloc package, and package-manager formulae for Homebrew, MacPorts, Chocolatey, Scoop, Winget, and Linux distributions.

### Sources

- <https://github.com/AlDanial/cloc#readme>
- <https://github.com/AlDanial/cloc/blob/master/Unix/NEWS>
- <https://github.com/AlDanial/cloc/releases>


## 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:** cloc
- **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

## Other Package-Manager Records

- Debian apt - cloc - 2.04-1: normalized package name match | Debian stable package indexes: cloc from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | statistics utility to count lines of code | https://github.com/AlDanial/cloc
- Nix - cloc: normalized package name match | nixpkgs package indexes: pkgs/by-name/cl/cloc/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - cloc - 1.98-1: normalized package name match | Ubuntu 24.04 LTS package indexes: cloc from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | statistics utility to count lines of code | https://github.com/AlDanial/cloc
- apk - cloc - 2.08-r0: normalized package name match | Alpine Linux edge package indexes: cloc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Count lines of code | https://github.com/AlDanial/cloc
- apk - cloc-doc - 2.08-r0: normalized package name match | Alpine Linux edge package indexes: cloc-doc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Count lines of code (documentation) | https://github.com/AlDanial/cloc
- dnf - cloc - 2.08-1.fc45: normalized package name match | Fedora Rawhide package metadata: cloc from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | Count lines of code | https://github.com/AlDanial/cloc
- pacman - cloc - 2.08-1: normalized package name match | Arch Linux sync databases: cloc from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | Count lines of code | https://github.com/AlDanial/cloc
- MacPorts - cloc: normalized package name match | MacPorts ports tree: textproc/cloc/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Chocolatey - CLOC: normalized package name match | Chocolatey community package catalog: CLOC from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','chocolatey-preinstaller-checks.extension'
- Scoop - main/cloc: normalized package name match | Scoop official bucket manifest trees: bucket/cloc.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1
- winget - AlDanial.Cloc: normalized package name match | Windows Package Manager source index: AlDanial.Cloc from https://cdn.winget.microsoft.com/cache/source.msix


## Related links

- [Source-control packages](https://www.automicvault.com/pkg/source-control-tools/) - Belongs to a source-control command family.
- [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.
- [loc](https://www.automicvault.com/pkg/brew/loc/) - Shares av.db curated category or tags: cli, code-analysis, developer-tools, metrics.
- [ohcount](https://www.automicvault.com/pkg/brew/ohcount/) - Shares av.db curated category or tags: cli, code-analysis, developer-tools, metrics.
- [cargo-llvm-lines](https://www.automicvault.com/pkg/brew/cargo-llvm-lines/) - Shares av.db curated category or tags: cli, code-analysis, developer-tools.
- [clang-include-graph](https://www.automicvault.com/pkg/brew/clang-include-graph/) - Shares av.db curated category or tags: cli, code-analysis, developer-tools.
- [clang-uml](https://www.automicvault.com/pkg/brew/clang-uml/) - Shares av.db curated category or tags: cli, code-analysis, developer-tools.
- [cppinsights](https://www.automicvault.com/pkg/brew/cppinsights/) - Shares av.db curated category or tags: cli, code-analysis, developer-tools.
- [fallow](https://www.automicvault.com/pkg/brew/fallow/) - Shares av.db curated category or tags: cli, code-analysis, developer-tools.
- [scc](https://www.automicvault.com/pkg/brew/scc/) - Shares av.db curated category or tags: cli, code-analysis, developer-tools.
- [cloc](https://www.automicvault.com/pkg/npm/cloc/) - Same normalized package name appears in another local ecosystem. Shared terms: analysis, cli, cloc, code, code-analysis.
- [cloc](https://www.automicvault.com/pkg/npm/cloc/) - Same normalized package name in another local ecosystem.

## Combined YAML source

View the package source record on GitHub. [combined/cloc.yml](https://github.com/automic-vault/db/blob/main/combined/cloc.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
