# 使用 Homebrew 安装 loc

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

## 安装

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

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install loc
```

  证据: local Homebrew formula metadata

## 软件包事实

- **软件包键:** brew:loc
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/loc>
- **版本:** 0.4.1
- **来源摘要:** Count lines of code quickly
- **主页:** <https://github.com/cgag/loc>
- **仓库:** <https://github.com/cgag/loc>
- **许可证:** MIT
- **源码归档:** <https://github.com/cgag/loc/archive/refs/tags/v0.4.1.tar.gz>
- **已生成:** 2026-08-04T22:13:35+00:00

## 可执行文件

- loc (cli)
- loc (别名)

## 构建依赖

- rust

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 arm64_big_sur, arm64_linux, arm64_monterey, arm64_sequoia, arm64_sonoma, arm64_tahoe, arm64_ventura, big_sur, catalina, monterey, sonoma, ventura

## 版本和新鲜度

- 页面生成时间: 2026-08-04
- 管理器版本: 0.4.1
- 本地数据: OK
- 上游仓库: https://github.com/cgag/loc
- 检测到的最新版本: v0.4.1 (当前)
- 信息: No package-manager update timestamp was available.
## 项目历史与用法

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.

### 项目历史

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.

### 采用历史

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.

### 使用方式

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.

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

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.

### 时间线

- 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.

### 来源

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


## 安全说明

narrow executable package without higher-risk signals.

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

## 源数据库详情

- **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


## 相关链接

- [Source-control packages](https://pkg.so/zh-hans/source-control-tools/) - Belongs to a source-control command family.
- [Terminal utility packages](https://pkg.so/zh-hans/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://pkg.so/zh-hans/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://pkg.so/zh-hans/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [rust](https://pkg.so/zh-hans/brew/rust/) - Build dependency declared by Homebrew.
- [cloc](https://pkg.so/zh-hans/brew/cloc/) - Shares pkgdb curated category or tags: cli, code-analysis, developer-tools, metrics.
- [ohcount](https://pkg.so/zh-hans/brew/ohcount/) - Shares pkgdb curated category or tags: cli, code-analysis, developer-tools, metrics.
- [scc](https://pkg.so/zh-hans/brew/scc/) - Shares pkgdb curated category or tags: cli, code-analysis, developer-tools.
- [fallow](https://pkg.so/zh-hans/brew/fallow/) - Shares pkgdb curated category or tags: cli, code-analysis, developer-tools.
- [astgen](https://pkg.so/zh-hans/brew/astgen/) - Shares pkgdb curated category or tags: cli, code-analysis, developer-tools.
- [clang-include-graph](https://pkg.so/zh-hans/brew/clang-include-graph/) - Shares pkgdb curated category or tags: cli, code-analysis, developer-tools.
- [cppinsights](https://pkg.so/zh-hans/brew/cppinsights/) - Shares pkgdb curated category or tags: cli, code-analysis, developer-tools.
- [lizard-analyzer](https://pkg.so/zh-hans/brew/lizard-analyzer/) - Shares pkgdb curated category or tags: cli, code-analysis, developer-tools, metrics.
- [cloc](https://pkg.so/zh-hans/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/mxcl/pkgdb/blob/main/combined/loc.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- package-page enrichment
- curated package history
- package version freshness
- pkgdb category and tag curation
- package relationship graph
- cross-ecosystem install command graph
