# 使用 Homebrew, apk, apt, dnf, MacPorts, Nix, zypper 安装 gojq

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

## 安装

```sh
sudo av install brew:gojq
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install gojq
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install gojq
```

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

### Linux

- apk (92%):

```sh
sudo apk add gojq
```

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

- Debian apt (92%):

```sh
sudo apt install gojq
```

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

- dnf (92%):

```sh
sudo dnf install gojq
```

  证据: Fedora Rawhide package metadata: gojq 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#gojq
```

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

- zypper (92%):

```sh
sudo zypper install gojq
```

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

## 软件包事实

- **软件包键:** brew:gojq
- **软件包管理器:** Homebrew
- **版本:** 0.12.19
- **来源摘要:** Pure Go implementation of jq
- **主页:** <https://github.com/itchyny/gojq>
- **仓库:** <https://github.com/itchyny/gojq>
- **最后更新:** 2026-07-29T16:05:04+02:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- gojq (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

gojq is a pure Go implementation of jq, the JSON query language and command-line processor. It can run as a command and can also be embedded as a Go library.

The project is valuable where jq compatibility is wanted without C-library and regex-library build dependencies, or where Go programs want an in-process jq-like query engine.

### 项目历史

The repository began in April 2019 with commits implementing the parser, runner, and CLI. The README frames the project as a jq implementation written in Go and documents both command usage and library APIs.

The release stream moved quickly through 0.x versions in 2019 and 2020, with v0.12.0 appearing in December 2020. Subsequent v0.12 patch releases continued the long maintenance line.

### 采用历史

gojq's package-manager adoption follows its portability story. The input package facts list apk, Homebrew, Debian, dnf, MacPorts, Nix, Ubuntu, and zypper packages, which fits a small CLI used across many Unix-like systems.

The README advertises installation through Homebrew, mise, Zero Install, go install, and Docker images. That broad install surface reflects both command-line use and reproducible automation contexts.

### 使用方式

At the command line, gojq reads JSON and applies jq filters such as .foo, .a.b, object construction, updates, and pipelines. The README highlights useful differences including arbitrary-precision integer calculations, YAML input/output options, and detailed error positions.

As a library, callers parse a query with gojq.Parse, run it against values decoded into []any or map[string]any, and iterate over results. Compile options cover module loading, environment loading, variables, custom functions, and input iterators.

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

gojq is significant because it ports one of the most package-manager-loved Unix data tools into a single Go build. That makes static or cross-platform distribution easier than the C jq stack in many environments.

It also exposes the tension in compatibility implementations: the README documents intentional differences from jq, including map ordering, unsupported flags, regex-engine differences, YAML support, and arbitrary-precision integers.

### 时间线

- 2019: Repository starts with parser, runner, and CLI implementation commits.
- 2019: v0.0.1 and v0.1.0 tags appear in April and May.
- 2020: v0.12.0 tag appears in December after rapid 0.x development.
- 2024: v0.12.17 tag appears in the continuing v0.12 maintenance series.

### Related projects

- jq is the original command and language that gojq implements.
- The Go standard library's encoding/json is relevant because gojq's library API expects generic decoded JSON-like Go values.
- mise and Docker are documented installation surfaces alongside package-manager installs.

### 来源

- <https://github.com/itchyny/gojq>
- <https://github.com/itchyny/gojq#readme>
- <https://pkg.go.dev/github.com/itchyny/gojq>


## 安全说明

narrow executable package without higher-risk signals.

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

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

- Debian apt - gojq - 0.12.13-1: normalized package name match | Debian stable package indexes: gojq from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | pure Go implementation of jq (program) | https://github.com/itchyny/gojq
- Debian apt - golang-github-itchyny-gojq-dev - 0.12.13-1: normalized package name match | Debian stable package indexes: golang-github-itchyny-gojq-dev from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | pure Go implementation of jq (library) | https://github.com/itchyny/gojq
- Nix - gojq: normalized package name match | nixpkgs package indexes: pkgs/by-name/go/gojq/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - gojq - 0.12.13-1: normalized package name match | Ubuntu 24.04 LTS package indexes: gojq from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | pure Go implementation of jq (program) | https://github.com/itchyny/gojq
- Ubuntu apt - golang-github-itchyny-gojq-dev - 0.12.13-1: normalized package name match | Ubuntu 24.04 LTS package indexes: golang-github-itchyny-gojq-dev from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | pure Go implementation of jq (library) | https://github.com/itchyny/gojq
- apk - gojq - 0.12.19-r3: normalized package name match | Alpine Linux edge package indexes: gojq from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Pure Go implementation of jq | https://github.com/itchyny/gojq
- apk - gojq-zsh-completion - 0.12.19-r3: normalized package name match | Alpine Linux edge package indexes: gojq-zsh-completion from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Zsh completions for gojq | https://github.com/itchyny/gojq
- dnf - gojq - 0.12.19-2.fc45: normalized package name match | Fedora Rawhide package metadata: gojq from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Pure Go implementation of jq | https://github.com/itchyny/gojq
- zypper - gojq - 0.12.19-1.5: normalized package name match | openSUSE Tumbleweed package metadata: gojq from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Pure Go implementation of jq | https://github.com/itchyny/gojq
- MacPorts - gojq: normalized package name match | MacPorts ports tree: textproc/gojq/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## Combined YAML source

View the package source record on GitHub. [combined/gojq.yml](https://github.com/mxcl/pkgdb/blob/main/combined/gojq.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
