# 使用 Homebrew, apk, Nix, pacman 安装 cargo-edit

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

## 安装

```sh
sudo av install brew:cargo-edit
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install cargo-edit
```

  证据: local Homebrew formula metadata

### Linux

- apk (92%):

```sh
sudo apk add cargo-edit
```

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

- Nix (92%):

```sh
nix profile install nixpkgs#cargo-edit
```

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

- pacman (92%):

```sh
sudo pacman -S cargo-edit
```

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

## 软件包事实

- **软件包键:** brew:cargo-edit
- **软件包管理器:** Homebrew
- **版本:** 0.13.13
- **来源摘要:** Utility for managing cargo dependencies from the command-line
- **主页:** <https://killercup.github.io/cargo-edit/>
- **仓库:** <https://github.com/killercup/cargo-edit>
- **最后更新:** 2026-07-15T20:49:45Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- cargo-add (别名)
- cargo-rm (别名)
- cargo-set-version (别名)
- cargo-upgrade (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

cargo-edit is one of the historically important Cargo extension suites: it brought command-line editing of Cargo.toml dependencies, removals, upgrades, and package versions into common Rust workflows before parts of that behavior were absorbed by Cargo itself.

### 项目历史

The GitHub repository was created in June 2015, early in Rust's post-1.0 package ecosystem, and the crate was published on crates.io in November 2015. Its README describes a tool that extends Cargo with commands for adding, removing, upgrading, and versioning dependencies by modifying Cargo.toml.

cargo-edit originally shipped commands including `cargo add`, `cargo rm`, `cargo upgrade`, and `cargo set-version`. The README now records an important handoff: `cargo add` became integrated into Cargo as of Rust 1.62, and `cargo rm` as of Rust 1.66, while cargo-edit continues to provide commands such as `cargo upgrade` and `cargo set-version`.

### 采用历史

cargo-edit became a standard recommendation because Cargo itself long lacked ergonomic subcommands for editing dependency requirements in manifests. Its presence in Homebrew, Nix, Arch Linux, and Alpine packaging, plus millions of crates.io downloads, reflects broad adoption by Rust developers and CI images.

The upstreaming of `cargo add` and `cargo rm` into Cargo is the strongest adoption signal: workflows popularized by cargo-edit influenced the default Rust toolchain instead of remaining only third-party extensions.

### 使用方式

Historically, users installed cargo-edit to run commands such as `cargo add serde`, `cargo rm old-crate`, `cargo upgrade`, and `cargo set-version 1.0.0`. Modern users mostly rely on Cargo's built-in add/remove commands and keep cargo-edit for dependency requirement upgrades and manifest version changes.

`cargo upgrade` changes version requirements in Cargo.toml, while `cargo update` only updates versions selected in Cargo.lock. That distinction is central to why cargo-edit remains useful for package-maintenance work.

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

cargo-edit is package-nerd canon because it sits at the exact boundary between package-manager UX and manifest syntax. It made Rust dependency declarations feel more like `npm install` or `go get` workflows while still editing Cargo.toml explicitly.

Its history also shows how successful extension commands can become part of the base package manager once the workflow proves itself.

### 时间线

- 2015: killercup/cargo-edit GitHub repository created.
- 2015: cargo-edit crate first published on crates.io.
- 2022: Cargo 1.62 integrated `cargo add`, according to the cargo-edit README.
- 2022: Cargo 1.66 integrated `cargo rm`, according to the cargo-edit README.
- 2026: crates.io metadata shows ongoing releases in the 0.13.x line.

### Related projects

- Cargo is the package manager extended by cargo-edit and later absorbed some of its commands.
- cargo-upgrade and cargo-set-version are the remaining command families documented by the README.
- The README points to related Cargo extension commands including cargo-feature and cargo-override.

### 来源

- <https://api.github.com/repos/killercup/cargo-edit>
- <https://crates.io/api/v1/crates/cargo-edit>
- <https://github.com/killercup/cargo-edit>
- <https://raw.githubusercontent.com/killercup/cargo-edit/master/README.md>
- input.source_facts.package-manager


## 安全说明

narrow executable package without higher-risk signals.

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

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

- Nix - cargo-edit: normalized package name match | nixpkgs package indexes: pkgs/by-name/ca/cargo-edit/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- apk - cargo-edit - 0.13.10-r0: normalized package name match | Alpine Linux edge package indexes: cargo-edit from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Managing cargo dependencies from the command line | https://github.com/killercup/cargo-edit
- apk - cargo-edit-doc - 0.13.10-r0: normalized package name match | Alpine Linux edge package indexes: cargo-edit-doc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Managing cargo dependencies from the command line (documentation) | https://github.com/killercup/cargo-edit
- pacman - cargo-edit - 0.13.13-1: normalized package name match | Arch Linux sync databases: cargo-edit from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | Managing cargo dependencies from the command line | https://github.com/killercup/cargo-edit/releases


## Combined YAML source

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