# 使用 Homebrew, Nix 安装 swift-protobuf

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

## 安装

```sh
sudo av install brew:swift-protobuf
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install swift-protobuf
```

  证据: local Homebrew formula metadata

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#protoc-gen-swift
```

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

## 软件包事实

- **软件包键:** brew:swift-protobuf
- **软件包管理器:** Homebrew
- **版本:** 1.38.1
- **来源摘要:** Plugin and runtime library for using protobuf with Swift
- **主页:** <https://github.com/apple/swift-protobuf>
- **仓库:** <https://github.com/apple/swift-protobuf>
- **最后更新:** 2026-06-23T19:48:06Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- protoc-gen-swift (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

Swift Protobuf is Apple's Swift implementation for Protocol Buffers, combining a `protoc` code-generation plugin with the SwiftProtobuf runtime library used by generated Swift code.

### 项目历史

The public repository was created in 2016, after Swift had become open source. The project joined Google's schema-first Protocol Buffers ecosystem by adding a Swift generator, `protoc-gen-swift`, and an idiomatic Swift runtime for generated types.

### 采用历史

The README documents multiple ways to consume the project: building the plugin with SwiftPM, installing the command-line generator through Homebrew, adding the runtime as a SwiftPM dependency, or consuming it through Xcode or CocoaPods. That mix reflects its dual role as both a CLI tool and a library dependency.

### 使用方式

Developers install or build `protoc-gen-swift`, run `protoc --swift_out=...` on `.proto` files, and add the SwiftProtobuf runtime to their Swift package, Xcode project, or CocoaPods project. The official documentation covers plugin behavior, generated-code APIs, internals, and contribution style.

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

Swift Protobuf matters to package-manager users because it bridges a language-specific package ecosystem with a cross-language serialization format. It gives Swift packages a generated-code workflow that stays compatible with Protocol Buffers used by Java, C++, Python, Objective-C, and other stacks.

### 时间线

- 2016: Public GitHub repository created.
- Current docs: Provides both `protoc-gen-swift` and the SwiftProtobuf runtime library.
- Current docs: Homebrew installs the protobuf compiler and Swift code-generator plugin.

### Related projects

- The README ties Swift Protobuf to Apple's Swift language, Google's Protocol Buffers and `protoc`, Swift Package Manager, Xcode package dependencies, and CocoaPods.

### 来源

- <https://api.github.com/repos/apple/swift-protobuf>
- <https://formulae.brew.sh/api/formula/swift-protobuf.json>
- <https://github.com/apple/swift-protobuf#readme>
- <https://github.com/apple/swift-protobuf/tree/main/Documentation>


## 安全说明

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


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

- Nix - protoc-gen-swift: installed executable or alias match | nixpkgs package indexes: pkgs/by-name/pr/protoc-gen-swift/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1


## Combined YAML source

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