# 使用 Homebrew, chocolatey, apt, dnf, MacPorts, Nix, pacman, zypper, scoop, winget 安装 yq

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

## 安装

```sh
sudo av install brew:yq
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install yq
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install yq
```

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

### Linux

- Debian apt (92%):

```sh
sudo apt install yq
```

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

- dnf (92%):

```sh
sudo dnf install yq
```

  证据: Fedora Rawhide package metadata: yq from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#yq
```

  证据: nixpkgs package indexes: yq from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix

- pacman (92%):

```sh
sudo pacman -S yq
```

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

- zypper (92%):

```sh
sudo zypper install yq
```

  证据: openSUSE Tumbleweed package metadata: yq from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

### Windows

- Chocolatey (92%):

```sh
choco install yq
```

  证据: Chocolatey community package catalog: yq from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','wsl-ubuntu-2204'

- Scoop (92%):

```sh
scoop install main/yq
```

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

- winget (92%):

```sh
winget install --id MikeFarah.yq -e
```

  证据: Windows Package Manager source index: MikeFarah.yq from https://cdn.winget.microsoft.com/cache/source.msix

## 软件包事实

- **软件包键:** brew:yq
- **软件包管理器:** Homebrew
- **版本:** 4.53.3
- **来源摘要:** Process YAML, JSON, XML, CSV and properties documents from the CLI
- **主页:** <https://github.com/mikefarah/yq>
- **仓库:** <https://github.com/mikefarah/yq>
- **最后更新:** 2026-07-25T21:32:50+02:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- yq (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

Mike Farah’s yq is a portable Go command-line processor for YAML and neighboring structured formats, best understood as the “jq-shaped” tool package users reach for when sed, awk, or ad hoc Python would be too brittle for configuration files.

### 项目历史

The mikefarah/yq repository was created in 2015 and grew out of a very practical niche: manipulating YAML from shell scripts. Older v3 documentation described the goal as being the jq or sed of YAML files; the modern README broadens that into a lightweight processor for YAML, JSON, INI, XML, TOML, properties, CSV, and TSV while retaining jq-like expression syntax.

The v4 line became the modern identity of the project: a dependency-free Go binary, installable through package managers or containers, with a richer expression language for reading, updating, merging, converting, and editing files in place. That v3-to-v4 split is historically important because many examples, packages, and user questions distinguish Mike Farah’s yq from both older yq syntax and the separate kislyuk/yq wrapper around jq.

### 采用历史

Adoption followed the rise of YAML-heavy infrastructure work: Kubernetes manifests, CI configuration, GitHub Actions workflows, Helm and Kustomize adjunct scripts, and release automation. The project documents Homebrew, snap, Docker/Podman, GitHub Action, and direct binary installation, and its repository badges track Docker pulls and GitHub release downloads.

The tool also became popular enough to create name-collision folklore: multiple unrelated tools are called yq, and users often have to verify whether their package manager installed Mike Farah’s Go implementation, kislyuk’s Python/jq wrapper, or an older major version.

### 使用方式

Typical usage is one-liner data surgery: read nested fields, update YAML in place, inject environment variables, merge files, convert YAML to JSON or XML to YAML, and compose expressions in CI scripts. Package users value that yq ships as a static-style Go binary, so it works well in minimal containers and build agents.

In package-nerd workflows, yq often sits next to jq: jq remains the canonical JSON processor, while yq handles the messy real-world files that package manifests, deployment descriptors, and CI systems store in YAML or adjacent formats.

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

yq is one of the canonical examples of a small CLI becoming infrastructure glue. It saves package maintainers from writing custom parsers for YAML edits, and its availability across Homebrew, Linux distributions, Windows package managers, containers, and GitHub Actions makes it a dependable assumption in cross-platform scripts.

Its significance is also social: when someone says “install yq,” package nerds immediately ask which yq and which major version. That ambiguity is part of the package’s history.

### 时间线

- 2015-09-26: The mikefarah/yq GitHub repository is created.
- 2019-2020: v3 documentation describes yq as a lightweight portable YAML processor aiming to be the jq or sed of YAML files.
- 2021: The v4 release line is active, with GitHub releases such as v4.9.0 and v4.10.0 published in May and July 2021.
- 2020s: The project expands its documented format support beyond YAML and JSON to XML, INI, properties, CSV, TSV, TOML, and related structured data.

### Related projects

- Related projects include jq, kislyuk/yq, gojq, dasel, Kubernetes, Helm, Kustomize, GitHub Actions, Docker, and Podman.

### 来源

- <https://api.github.com/repos/mikefarah/yq>
- <https://github.com/mikefarah/yq>
- <https://hub.docker.com/r/mikefarah/yq>
- <https://mikefarah.gitbook.io/yq>
- <https://mikefarah.gitbook.io/yq/usage/github-action>
- <https://mikefarah.gitbook.io/yq/v3.x>


## 安全说明

narrow executable package without higher-risk signals.

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

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

- Debian apt - yq - 3.4.3-2: normalized package name match | Debian stable package indexes: yq from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Command-line YAML processor - jq wrapper for YAML documents | https://github.com/kislyuk/yq
- Nix - yq: normalized package name match | nixpkgs package indexes: yq from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix
- Ubuntu apt - yq - 3.1.0-3: normalized package name match | Ubuntu 24.04 LTS package indexes: yq from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | Command-line YAML processor - jq wrapper for YAML documents | https://github.com/kislyuk/yq
- dnf - yq - 4.53.3-2.fc45: normalized package name match | Fedora Rawhide package metadata: yq from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Yq is a portable command-line YAML, JSON, XML, CSV, TOML, HCL and properties processor | https://github.com/mikefarah/yq
- pacman - yq - 4.1.2-1: normalized package name match | Arch Linux sync databases: yq from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents | https://github.com/kislyuk/yq
- zypper - yq - 4.53.3-2.1: normalized package name match | openSUSE Tumbleweed package metadata: yq from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | A portable command-line YAML processor | https://github.com/mikefarah/yq
- zypper - yq-bash-completion - 4.53.3-2.1: normalized package name match | openSUSE Tumbleweed package metadata: yq-bash-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Bash Completion for yq | https://github.com/mikefarah/yq
- zypper - yq-fish-completion - 4.53.3-2.1: normalized package name match | openSUSE Tumbleweed package metadata: yq-fish-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Fish Completion for yq | https://github.com/mikefarah/yq
- zypper - yq-zsh-completion - 4.53.3-2.1: normalized package name match | openSUSE Tumbleweed package metadata: yq-zsh-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Zsh Completion for yq | https://github.com/mikefarah/yq
- MacPorts - yq: normalized package name match | MacPorts ports tree: textproc/yq/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Chocolatey - yq: normalized package name match | Chocolatey community package catalog: yq from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','wsl-ubuntu-2204'
- Scoop - main/yq: normalized package name match | Scoop official bucket manifest trees: bucket/yq.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1
- winget - MikeFarah.yq: normalized package name match | Windows Package Manager source index: MikeFarah.yq from https://cdn.winget.microsoft.com/cache/source.msix


## Combined YAML source

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


## 来源

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