# 使用 Homebrew, apk, MacPorts, Nix 安装 oq

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

## 安装

```sh
sudo av install brew:oq
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install oq
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install oq
```

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

### Linux

- apk (92%):

```sh
sudo apk add oq
```

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

- Nix (92%):

```sh
nix profile install nixpkgs#oq
```

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

## 软件包事实

- **软件包键:** brew:oq
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/oq>
- **版本:** 1.3.5
- **来源摘要:** Performant, and portable jq wrapper to support formats other than JSON
- **主页:** <https://blacksmoke16.github.io/oq>
- **仓库:** <https://github.com/Blacksmoke16/oq>
- **上游文档:** <https://blacksmoke16.github.io/oq>
- **许可证:** MIT
- **源码归档:** <https://github.com/Blacksmoke16/oq/archive/refs/tags/v1.3.5.tar.gz>
- **已生成:** 2026-08-04T22:13:35+00:00

## 可执行文件

- oq (cli)
- oq (别名)

## 依赖

- bdw-gc
- libyaml
- pcre2

## 构建依赖

- crystal

## macOS 提供的库

- jq
- libxml2

## 安装行为

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

## 版本和新鲜度

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

oq is a Crystal-written wrapper around `jq` that converts non-JSON formats into JSON for filtering and then serializes the result back out. Its core idea is to keep jq's filter language while adding practical YAML and XML input/output paths.

### 项目历史

George Dietrich introduced oq in a 2019 article after comparing existing jq-adjacent tooling and wanting a more portable, higher-performance option for large non-JSON documents. The project goals were portability, performance, and extending the formats that jq can handle without replacing jq's filter language.

The 1.x series broadened oq from a CLI into a small Crystal library as well. Release notes for v1.2.0 describe library support, a SimpleYAML format for streamable large inputs, and better handling of multiple non-JSON files; v1.3.0 added XML namespace options and forced-array behavior for XML parsing.

### 采用历史

oq remains a niche developer utility, but it has enough packaging surface to be available through Homebrew, Alpine, MacPorts, and Nix in the input metadata. Homebrew describes it as a performant and portable jq wrapper, with Crystal required only for source builds.

### 使用方式

A typical use keeps jq syntax in place and adds format flags, such as reading YAML with `-i yaml`, writing XML with `-o xml`, or using the tool as a Crystal dependency through `OQ::Processor`. That makes it useful in shell scripts where JSON, YAML, and XML need the same transformation logic.

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

oq is package-nerd interesting because it does less than a full data-query language and more than a one-off converter. It packages the proven jq execution model with format adapters and a single-binary distribution story, which is often the sweet spot for command-line glue.

### 时间线

- 2019: The author publishes the oq introduction and motivation.
- 2021-02-27: v1.2.0 adds library support, SimpleYAML, and improved multiple-file handling for non-JSON inputs.
- 2021-08-17: v1.3.0 adds XML namespace controls and XML force-array behavior.
- 2024-04-04: v1.3.5 is tagged.

### Related projects

- oq depends conceptually on jq and overlaps with yq-style data conversion workflows. Its implementation and library surface are tied to Crystal, libyaml, and XML/JSON conversion behavior.

### 来源

- <https://blacksmoke16.github.io/oq/>
- <https://dev.to/blacksmoke16/oq-a-portable-performant-jq-wrapper-18ka>
- <https://formulae.brew.sh/formula/oq>
- <https://github.com/Blacksmoke16/oq>
- <https://github.com/Blacksmoke16/oq/releases>
- <https://github.com/Blacksmoke16/oq/tags>


## 安全说明

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:** oq
- **Version Scheme:** 0
- **Revision:** 2
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** stable

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

- Nix - oq: normalized package name match | nixpkgs package indexes: pkgs/by-name/oq/oq/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- apk - oq - 1.3.5-r0: normalized package name match | Alpine Linux edge package indexes: oq from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | portable jq wrapper with support of other formats than JSON | https://github.com/blacksmoke16/oq
- MacPorts - oq: normalized package name match | MacPorts ports tree: devel/oq/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## 相关链接

- [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.
- [pcre2](https://pkg.so/zh-hans/brew/pcre2/) - Runtime dependency declared by Homebrew.
- [crystal](https://pkg.so/zh-hans/brew/crystal/) - Build dependency declared by Homebrew.
- [python-yq](https://pkg.so/zh-hans/brew/python-yq/) - Shares pkgdb curated category or tags: cli, data-processing, developer-tools, jq, json.
- [dasel](https://pkg.so/zh-hans/brew/dasel/) - Shares pkgdb curated category or tags: cli, data-processing, developer-tools, json.
- [ijq](https://pkg.so/zh-hans/brew/ijq/) - Shares pkgdb curated category or tags: cli, developer-tools, jq, json.
- [jaq](https://pkg.so/zh-hans/brew/jaq/) - Shares pkgdb curated category or tags: cli, data-processing, developer-tools, jq, json.
- [jnv](https://pkg.so/zh-hans/brew/jnv/) - Shares pkgdb curated category or tags: cli, developer-tools, jq, json.
- [jqp](https://pkg.so/zh-hans/brew/jqp/) - Shares pkgdb curated category or tags: cli, developer-tools, jq, json.
- [gojq](https://pkg.so/zh-hans/brew/gojq/) - Shares pkgdb curated category or tags: cli, developer-tools, jq, json.
- [orc-tools](https://pkg.so/zh-hans/brew/orc-tools/) - Shares pkgdb curated category or tags: cli, data-processing, developer-tools.

## Combined YAML source

View the package source record on GitHub. [combined/oq.yml](https://github.com/mxcl/pkgdb/blob/main/combined/oq.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
- external package-manager database matches
- cross-ecosystem install command graph
