You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: A reference page for the rust resource
4
+
---
5
+
6
+
The rust resource installs [Rust](https://www.rust-lang.org/) via [rustup](https://rustup.rs/), the official Rust toolchain installer. It also manages global CLI tools installed through `cargo install`. Supported on macOS and Linux.
7
+
8
+
## Parameters:
9
+
10
+
-**cargoPackages**: *(array[string])* Global CLI tools to install via `cargo install`. Use the `name@version` syntax to pin a specific version (e.g. `"ripgrep@14.1.0"`). Omitting the version installs the latest release. Codify adds packages that are missing and removes packages that are no longer listed (in stateful mode).
11
+
12
+
## Example usage:
13
+
14
+
### Install Rust with common CLI tools
15
+
16
+
```json title="codify.jsonc"
17
+
[
18
+
{
19
+
"type": "rust",
20
+
"cargoPackages": ["ripgrep", "bat", "fd-find"]
21
+
}
22
+
]
23
+
```
24
+
25
+
### Install Rust with pinned package versions
26
+
27
+
```json title="codify.jsonc"
28
+
[
29
+
{
30
+
"type": "rust",
31
+
"cargoPackages": ["ripgrep@14.1.0", "bat@0.24.0"]
32
+
}
33
+
]
34
+
```
35
+
36
+
### Install Rust without any additional packages
37
+
38
+
```json title="codify.jsonc"
39
+
[
40
+
{
41
+
"type": "rust"
42
+
}
43
+
]
44
+
```
45
+
46
+
## Notes:
47
+
48
+
- On macOS, Xcode Command Line Tools must be installed before applying the rust resource. The [xcode-tools](/docs/resources/xcode-tools) resource can install them, and is added as a dependency automatically.
49
+
- Rust is installed via the official `rustup` script (`https://sh.rustup.rs`). This adds `~/.cargo/bin` to your `PATH` in your shell RC file. Open a new terminal after applying to pick up the updated `PATH`.
50
+
- To uninstall Rust and the toolchain, remove the rust resource from your config and run `codify apply`. This runs `rustup self uninstall`.
51
+
- Package versions in `cargoPackages` must match a published version on [crates.io](https://crates.io). To find available versions, run `cargo search <name>` or visit the crate's page on crates.io.
52
+
- Omitting `@version` for a package always tracks the latest release. Adding `@version` pins the exact version and will reinstall if the pin changes.
0 commit comments