# 使用 Homebrew, apk, Nix, pacman, scoop 安装 yamlfmt

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

## 安装

```sh
sudo av install brew:yamlfmt
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install yamlfmt
```

  证据: local Homebrew formula metadata

### Linux

- apk (92%):

```sh
sudo apk add yamlfmt
```

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

- Nix (92%):

```sh
nix profile install nixpkgs#yamlfmt
```

  证据: nixpkgs package indexes: pkgs/by-name/ya/yamlfmt/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S yamlfmt
```

  证据: Arch Linux sync databases: yamlfmt from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

### Windows

- Scoop (92%):

```sh
scoop install main/yamlfmt
```

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

## 软件包事实

- **软件包键:** brew:yamlfmt
- **软件包管理器:** Homebrew
- **版本:** 0.21.0
- **来源摘要:** Extensible command-line tool to format YAML files
- **主页:** <https://github.com/google/yamlfmt>
- **仓库:** <https://github.com/google/yamlfmt>
- **最后更新:** 2026-07-25T21:32:48+02:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- yamlfmt (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 0.21.0
## 项目历史与用法

Google yamlfmt is a Go command-line formatter and library for YAML files. Its goals are explicit: be easy to distribute as a single binary, be extensible with custom formatters, and be usable as a library foundation for teams that need a customized YAML formatter.

### 项目历史

The repository was created on 2022-08-10. The README describes the project as an extensible formatter rather than only a fixed style tool: users can run the `yamlfmt` command, install it as a pre-commit hook, use a container image, or build on the library APIs.

The project grew around formatter backends and configuration. The default `basic` formatter serializes YAML through a fork of gopkg.in/yaml.v3, while the `kyaml` formatter targets Kubernetes YAML style. The docs also record caveats around YAML directives, anchors, aliases, line breaks, and line-length behavior, showing the practical complexity behind YAML formatting.

### 采用历史

yamlfmt has a broad package-manager footprint in the supplied data, including Homebrew, Nix, apk, pacman, and Scoop. Its README also presents Go installation, release binaries, pre-commit integration, and a container image, which fits modern developer-tool adoption through local hooks and CI checks.

The repository lives under the Google organization but the README states that it is not officially supported by Google and is maintained primarily by an individual maintainer in spare time. That makes it an interesting case where a high-visibility org namespace helped adoption of a still-community-paced developer tool.

### 使用方式

Basic usage is `yamlfmt x.yaml y.yaml ...` or `yamlfmt .`, where directories are searched recursively for `.yaml` and `.yml` files. The `-dstar` mode enables doublestar glob matching, and `-lint` supports CI workflows that check formatting without rewriting files.

Configuration is discovered from a `-conf` flag, the working directory, ancestor directories, or a system config directory. Supported config filenames include `.yamlfmt`, `yamlfmt.yml`, `yamlfmt.yaml`, `.yamlfmt.yaml`, and `.yamlfmt.yml`.

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

yamlfmt is package-nerd significant because it packages the messy YAML-formatting problem as a distributable Go binary with docs for hooks, containers, global config, and release artifact verification.

It also represents the split in YAML tooling between generic style normalization and domain-specific formats such as Kubernetes KYAML, a distinction that matters to maintainers choosing formatter defaults for large repositories.

### 时间线

- 2022-08-10: GitHub repository created.
- 2020s: Project goals documented around single-binary distribution, custom formatter extension, and library use.
- 2020s: Configuration discovery documented across local project files, ancestor search, and platform config directories.
- 2020s: README documented pre-commit, container, and CI usage patterns.

### Related projects

- Related projects and technologies include gopkg.in/yaml.v3, Kubernetes KYAML, pre-commit, bmatcuk/doublestar, cosign, and container-based CI runners.

### 来源

- <https://api.github.com/repos/google/yamlfmt>
- <https://github.com/google/yamlfmt>
- <https://raw.githubusercontent.com/google/yamlfmt/main/README.md>
- <https://raw.githubusercontent.com/google/yamlfmt/main/docs/config-file.md>


## 安全说明

narrow executable package without higher-risk signals.

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


## 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: .yamlfmt, yamlfmt.yml, yamlfmt.yaml, .yamlfmt.yaml, .yamlfmt.yml, $XDG_CONFIG_HOME/yamlfmt/.yamlfmt, ~/.config/yamlfmt/.yamlfmt
- Windows: %LOCALAPPDATA%\yamlfmt\.yamlfmt
## 其他软件包管理器记录

- Nix - yamlfmt: normalized package name match | nixpkgs package indexes: pkgs/by-name/ya/yamlfmt/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- apk - yamlfmt - 0.21.0-r6: normalized package name match | Alpine Linux edge package indexes: yamlfmt from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | An extensible command line tool or library to format yaml files | https://github.com/google/yamlfmt
- apk - yamlfmt-doc - 0.21.0-r6: normalized package name match | Alpine Linux edge package indexes: yamlfmt-doc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | An extensible command line tool or library to format yaml files (documentation) | https://github.com/google/yamlfmt
- pacman - yamlfmt - 0.21.0-1: normalized package name match | Arch Linux sync databases: yamlfmt from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | An extensible command line tool or library to format yaml files. | https://github.com/google/yamlfmt
- Scoop - main/yamlfmt: normalized package name match | Scoop official bucket manifest trees: bucket/yamlfmt.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1


## Combined YAML source

View the package source record on GitHub. [combined/yamlfmt.yml](https://github.com/mxcl/pkgdb/blob/main/combined/yamlfmt.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
