# Install loc with Homebrew

Count lines of code quickly. Version 0.4.1 via Homebrew; verified from local package data.

## Install

```sh
sudo av install brew:loc
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install loc
```

  Evidence: local Homebrew formula metadata

## Package facts

- **Package key:** brew:loc
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/loc>
- **Version:** 0.4.1
- **Source summary:** Count lines of code quickly
- **Homepage:** <https://github.com/cgag/loc>
- **Repository:** <https://github.com/cgag/loc>
- **Upstream docs:** <https://github.com/cgag/loc#readme>
- **License:** MIT
- **Source archive:** <https://github.com/cgag/loc/archive/refs/tags/v0.4.1.tar.gz>
- **Generated:** 2026-07-08T18:08:21+00:00

## Executables

- loc (cli)
- loc (alias)

## Build dependencies

- rust

## 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, catalina, monterey, sonoma, ventura

## Freshness

- Page generated: 2026-07-08
- Package-manager version: 0.4.1
- Local data: ok
- Upstream repository: https://github.com/cgag/loc
- Upstream latest detected: v0.4.1 (current)
- info: No package-manager update timestamp was available.
## Project history and usage

loc is a Rust command-line tool for quickly counting lines of code. Its README describes it as a Rust implementation of cloc focused on speed, reporting file, line, blank, comment, and code counts by language.

### Project history

The cgag/loc GitHub repository was created in July 2016. The README positions loc directly against cloc and tokei, with old benchmark examples showing loc as much faster on large source trees, while also warning readers that tokei may be smarter or more accurate for some cases.

### Adoption history

loc's adoption is concentrated among developers who want a fast one-shot codebase counter and are comfortable with Rust-built CLI tools. Official evidence points to GitHub interest, release binaries, cargo install, and a Homebrew package rather than a large ecosystem of integrations.

### How it is used

By default, loc counts the current directory or a target path and prints a language table with files, total lines, blank lines, comments, and code. It is used for quick repository sizing, comparing implementation-language mix, and sanity-checking source tree growth.

### Why package nerds care

loc is significant in the package-manager catalog as part of the Rust rewrite wave of classic Unix developer tools: a narrow utility, fast startup, static-ish binaries, and simple install paths through cargo or Homebrew. Its README also records the healthy package-nerd humility of pointing users at tokei when accuracy matters more than raw speed.

### Timeline

- 2016: The cgag/loc repository is created.
- 2018: README note points users to tokei as a smarter and more accurate related Rust counter.
- 2020s: loc remains available through Homebrew and source/release installation paths.

### Related projects

- cloc is the older Perl tool that loc explicitly reimplements for speed.
- tokei is the related Rust code-counting tool that loc compares against and recommends checking for accuracy-sensitive work.

### Sources

- <https://api.github.com/repos/cgag/loc>
- <https://github.com/cgag/loc>
- source_facts.package-manager


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


## 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.
- [rust](https://www.automicvault.com/pkg/brew/rust/) - Build dependency declared by Homebrew.
- [cloc](https://www.automicvault.com/pkg/brew/cloc/) - 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/) - Local package facts share a topical domain. Shared terms: analysis, cli, code, code-analysis, count.

## Combined YAML source

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