# 使用 Homebrew, apt, dnf 安装 clang-format

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

## 安装

```sh
sudo av install brew:clang-format
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install clang-format
```

  证据: local Homebrew formula metadata

### Linux

- Debian apt (92%):

```sh
sudo apt install clang-format
```

  证据: Debian stable package indexes: clang-format from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install git-clang-format
```

  证据: Fedora Rawhide package metadata: git-clang-format from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst

## 软件包事实

- **软件包键:** brew:clang-format
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/clang-format>
- **版本:** 22.1.8
- **来源摘要:** Formatting tools for C, C++, Obj-C, Java, JavaScript, TypeScript
- **主页:** <https://clang.llvm.org/docs/ClangFormat.html>
- **仓库:** <https://github.com/llvm/llvm-project>
- **上游文档:** <https://clang.llvm.org/docs/ClangFormat.html>
- **许可证:** Apache-2.0 WITH LLVM-exception
- **源码归档:** <https://github.com/llvm/llvm-project/releases/download/llvmorg-22.1.8/llvm-project-22.1.8.src.tar.xz>
- **最后更新:** 2026-06-16T19:45:28Z
- **已生成:** 2026-07-10T07:20:53+00:00

## 可执行文件

- clang-format (cli)
- git-clang-format (cli)
- clang-format (别名)
- git-clang-format (别名)

## 构建依赖

- cmake

## macOS 提供的库

- python

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## 版本和新鲜度

- 页面生成时间: 2026-07-10
- 管理器版本: 22.1.8
- 管理器更新时间: 2026-06-16
- 本地数据: OK
- 上游仓库: https://github.com/llvm/llvm-project
- 信息: No cached GitHub release or tag data was available.
## 项目历史与用法

clang-format is LLVM/Clang's source formatter and editor-integration tool for C-family and several adjacent languages. It became a standard package-manager dependency because teams can install one CLI and enforce formatting locally, in editors, in Git workflows, and in CI.

### 项目历史

LLVM's Clang 3.3 documentation already described ClangFormat as tools built on LibFormat, with a standalone clang-format binary under clang/tools/clang-format. Later documentation expanded language coverage, configuration files, ignore files, and editor integrations.

### 采用历史

The supplied package-manager data shows Homebrew, Debian, Fedora/DNF, and Ubuntu packaging. Its adoption is reinforced by direct editor integration in Vim, Emacs, BBEdit, CLion, Visual Studio, and similar tooling documented by LLVM.

### 使用方式

Users run clang-format over files or standard input, often with -i for in-place edits. Project style is commonly stored in .clang-format or _clang-format, generated with -dump-config, and found by using -style=file.

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

clang-format is significant because it decouples source formatting policy from any one IDE. Package managers provide a pinned binary that projects can call from hooks, CI jobs, editor plugins, and language-server-style workflows, making formatting reproducible across operating systems.

### 时间线

- 2013: Clang 3.3 documentation included clang-format for C/C++/Obj-C.
- 2014: Clang 3.4 documentation documented multi-file formatting and dump-config support.
- 2020: LLVM 11 release notes continued adding clang-format style options such as IndentExternBlock.
- 2026: Current LLVM documentation lists broader language support including Java, JavaScript, JSON, TypeScript, C#, Protobuf, and Objective-C.

### Related projects

- Related projects include LLVM, Clang, LibFormat, git-clang-format, clang-format editor plugins, clangd, and language-specific formatters such as gofmt, rustfmt, black, and prettier.

### 来源

- <https://clang.llvm.org/docs/ClangFormat.html>
- <https://github.com/llvm/llvm-project>
- <https://releases.llvm.org/3.3/tools/clang/docs/ClangFormat.html>
- <https://releases.llvm.org/3.4/tools/clang/docs/ClangFormat.html>
- <https://releases.llvm.org/11.1.0/tools/clang/docs/ReleaseNotes.html>


## 安全说明

没有找到 clang-format 的匹配本地密钥处理 manifest。Nucleus 软件包元数据仍在此发布，以便未来覆盖拥有稳定的软件包 URL。



## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: .clang-format, _clang-format
## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** clang-format
- **Aliases:** clang-format@22
- **Version Scheme:** 1
- **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

## 其他软件包管理器记录

- Debian apt - clang-format - 1:19.0-63: normalized package name match | Debian stable package indexes: clang-format from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Tool to format C/C++/Obj-C code
- Ubuntu apt - clang-format - 1:18.0-59~exp2: normalized package name match | Ubuntu 24.04 LTS package indexes: clang-format from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | Tool to format C/C++/Obj-C code
- dnf - git-clang-format - 22.1.7-1.fc45: installed executable or alias match | Fedora Rawhide package metadata: git-clang-format from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | Integration of clang-format for git | http://llvm.org


## 相关链接

- [Language runtime packages](https://www.automicvault.com/zh-hans/pkg/language-runtime-packages/) - Matched language runtime, compiler, or interpreter metadata.
- [Networking and protocol packages](https://www.automicvault.com/zh-hans/pkg/networking-protocol-tools/) - Matched network, protocol, or remote-service metadata.
- [Documentation packages](https://www.automicvault.com/zh-hans/pkg/documentation-tools/) - Matched documentation, manual, or publishing metadata.
- [Web development packages](https://www.automicvault.com/zh-hans/pkg/web-dev-tools/) - Matched web development metadata.
- [cmake](https://www.automicvault.com/zh-hans/pkg/brew/cmake/) - Build dependency declared by Homebrew.
- [clang-format@11](https://www.automicvault.com/zh-hans/pkg/brew/clang-format-11/) - Package name indicates the same formula family.
- [flang](https://www.automicvault.com/zh-hans/pkg/brew/flang/) - Shares the same upstream source repository.
- [lld](https://www.automicvault.com/zh-hans/pkg/brew/lld/) - Shares the same upstream source repository.
- [clang-format](https://www.automicvault.com/zh-hans/pkg/npm/clang-format/) - Same normalized package name in another local ecosystem.

## Combined YAML source

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


## 来源

- Nucleus package database
- package-page enrichment
- curated configuration and credential file locations
- curated package history
- package version freshness
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
