setup-rust-analyzerlisted
Install: claude install-skill StGerman/crewd
# Setting up rust-analyzer MCP
[.mcp.json](../../../.mcp.json) spawns `$HOME/.cargo/bin/rust-analyzer-mcp`, which in turn
spawns `rust-analyzer` from `PATH`. Three pieces have to be present; the SessionStart hook
([.claude/hooks/rust-analyzer-check.sh](../../hooks/rust-analyzer-check.sh)) names whichever
are missing.
## 1. Identify the toolchain flavor first
The install commands differ, and the wrong one fails confusingly:
```bash
command -v rustup cargo rustc
```
- **rustup present** — components come from rustup.
- **cargo/rustc present, no rustup** (e.g. `brew install rust`) — Homebrew's `rust` formula
ships `rust-src` but **not** `rust-analyzer`, and `rustup component add` does not exist.
This is the case that makes the CLAUDE.md quickstart wrong if followed literally.
- **neither** — install a toolchain first (`brew install rustup-init && rustup-init`, or
rustup.rs).
## 2. Install the missing pieces
`rust-analyzer` — the language server:
```bash
rustup component add rust-analyzer # rustup toolchains
brew install rust-analyzer # Homebrew toolchains (separate formula from `rust`)
```
`rust-src` — std sources. Without them `hover`/`definition` into `std` answer blank:
```bash
rustup component add rust-src # rustup only; Homebrew's `rust` already includes it
```
Verify either way — this path must exist:
```bash
ls "$(rustc --print sysroot)/lib/rustlib/src/rust"
```
`rust-analyzer-mcp` — the MCP bridge. Always via cargo, on every flavor.