> ## Documentation Index
> Fetch the complete documentation index at: https://herd.laravel.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage Rust

# Managing Rust

Herd serves [Laravel for Rust](https://herd.laravel.com/docs/macos/guides/laravel-rust.md) applications next to your PHP sites. Herd builds and runs these applications with your Rust toolchain, so Rust has to be installed on your Mac. You can install it and keep it up to date right from Herd.

Rust is optional. If you only work on PHP applications, you don't need to install it.

## Installing Rust

Open the settings, go to "Runtimes" and select "Rust". Click "Install" and Herd downloads `rustup`, the official Rust installer, and installs the latest stable version of Rust. The installation takes a few minutes and needs about 540 MB of disk space. You can keep using Herd in the meantime.

Herd also offers to install Rust during the onboarding and in the What's New window of Herd 2.3, so you may already have it.

Herd installs Rust into `~/.cargo` and `~/.rustup`, where `rustup` always installs it, and makes `cargo` available in your terminal. Your editor, your coding agents and Herd all use the same toolchain, so none of them has to rebuild what another one already built.

### Apple Developer Tools

Rust uses the linker from Apple's Command Line Tools to build applications. Without them, every build fails. If the Command Line Tools are missing, Herd shows an "Apple Developer Tools" row on the Rust settings page, and macOS asks you to install them after Herd installed Rust. You can also install them from your terminal:

```bash theme={null}
xcode-select --install
```

## Using an existing Rust installation

If Rust is already installed on your Mac, Herd uses it and doesn't install a second copy. Herd looks for `cargo` in the following places, in this order:

* `$CARGO_HOME/bin`, or `~/.cargo/bin` if `CARGO_HOME` isn't set
* `/opt/homebrew/opt/rustup/bin` and `/usr/local/opt/rustup/bin`
* `/opt/homebrew/bin` and `/usr/local/bin`

Herd can update a toolchain that `rustup` manages. If you installed Rust with another tool, for example with Homebrew's `rust` formula, Herd uses it as it is and you update it with the tool that installed it.

## Updating Rust

When you open the Rust settings, Herd checks for a new stable release of Rust and shows an "Update" button if there is one. Updating Rust rebuilds every Laravel for Rust application from scratch on its next start, so the first visit after an update takes a bit longer.

You can also update Rust from your terminal:

```bash theme={null}
rustup update
```

## Uninstalling Rust

Herd doesn't uninstall Rust, because other tools on your Mac may use it as well. If you want to remove Rust, run the uninstaller of `rustup`:

```bash theme={null}
rustup self uninstall
```
