# 使用 Homebrew, Nix 安装 needle

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

## 安装

```sh
sudo av install brew:needle
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install needle
```

  证据: local Homebrew formula metadata

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#needle
```

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

## 软件包事实

- **软件包键:** brew:needle
- **软件包管理器:** Homebrew
- **版本:** 0.25.1
- **来源摘要:** Compile-time safe Swift dependency injection framework with real code
- **主页:** <https://github.com/uber/needle>
- **仓库:** <https://github.com/uber/needle>
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- needle (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

Needle is Uber's Swift dependency-injection system. Its distinguishing idea is to make dependency wiring explicit, hierarchical, and code-generated so missing or invalid dependencies fail at compile time instead of becoming runtime container lookups.

### 项目历史

The public GitHub repository was created on 2018-04-06. The README frames Needle against Swift DI libraries such as Cleanse and Swinject, while comparing its compile-time generated graph more closely to Dagger on the JVM. The project goals call out high reliability, code generation performance for multi-million-line codebases, and compatibility with iOS architectures including RIBs and MVx.

Needle ships both a runtime framework, NeedleFoundation, and the `needle` generator executable packaged by Homebrew. Its release process documentation explicitly includes publishing to CocoaPods and Homebrew, which matches its split identity as both a Swift package/library and a developer tool installed into build phases.

### 采用历史

Needle's primary adoption channel is iOS application architecture, especially large Swift apps where runtime service locators are too loose and hand-wired dependency trees become noisy. Swift Package Index listed the package as in development for 8 years, with 42 releases and 42 contributors when checked in 2026, and the GitHub API showed 2,006 stars and 160 forks on 2026-07-01.

Homebrew is important because teams usually need the generator binary in local and CI builds. Homebrew's formula page showed stable version 0.25.1 and 1,766 installs over 365 days, 70 over 90 days, and 17 over 30 days when checked on 2026-07-01.

### 使用方式

In practice, developers add NeedleFoundation to a Swift app, model scopes as `Component` types, express dependencies as Swift protocols, then run `needle generate` to emit a generated file that wires the graph. The generator is commonly invoked from an Xcode build phase or CI step so dependency graph mistakes become compilation errors.

Needle is attractive to package nerds because the Homebrew formula is not the library itself; it is the code-generation tool that makes the library's safety story work. That puts it in the same operational family as SwiftGen, Sourcery, and other source-generation CLIs that become part of a build pipeline.

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

Needle is a notable example of a company-scale mobile architecture tool packaged for general use. It shows how a Swift library can require a separately installed command-line generator, and why Homebrew remains relevant even for ecosystems that also use Swift Package Manager or CocoaPods.

### 时间线

- 2018-04-06: Public GitHub repository created.
- 2019: Community tutorials and comparisons began presenting Needle as Uber's compile-time-safe Swift DI option.
- 2024-08: GitHub releases page listed v0.25.1 with Swift 6-related release notes.
- 2026-07-01: Homebrew formula stable version observed as 0.25.1.

### Related projects

- NeedleFoundation
- Swinject
- Cleanse
- Dagger
- Uber RIBs

### 来源

- <https://api.github.com/repos/uber/needle>
- <https://formulae.brew.sh/formula/needle>
- <https://github.com/uber/needle>
- <https://github.com/uber/needle/blob/master/RELEASE.md>
- <https://swiftpackageindex.com/uber/needle>


## 安全说明

narrow executable package without higher-risk signals.

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

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

- Nix - needle: normalized package name match | nixpkgs package indexes: pkgs/by-name/ne/needle/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/needle.yml](https://github.com/mxcl/pkgdb/blob/main/combined/needle.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
