Install Rust on Arch Linux

Developer workstation

Rust is a systems programming language focused on speed, memory safety, and concurrency. On Arch Linux, the cleanest and most reliable way to install Rust is through rustup. This gives you control over stable, beta, and nightly toolchains and avoids the common problem where the Rust packages are installed but the compiler commands are still not available in your shell.

This page shows the full installation flow, the environment setup that fixes the usual “command not found” problem, and a quick test project to confirm everything is working.

Terminal on laptop

On Arch Linux, install Rust the recommended way with rustup:

sudo pacman -S rustup

This installs the Rust toolchain manager, which is the preferred method because it lets you manage Rust versions properly instead of depending on a single distro-packaged compiler version.

Coding screen

After installing rustup, initialize the default stable Rust toolchain:

rustup default stable

This installs the stable versions of:

  • rustc — the Rust compiler
  • cargo — the Rust package manager and build tool
  • standard library components needed to build Rust programs

Shell environment

The most common reason Rust appears to be installed but rust, rustc, or cargo still fail is that your shell has not loaded Cargo’s environment yet.

Load it immediately with:

source $HOME/.cargo/env

Or restart your shell session:

exec $SHELL

This adds $HOME/.cargo/bin to your current shell session so Rust commands become available right away.

Verification in terminal

Run these commands to confirm the toolchain is installed and available:

rustc --version
cargo --version

If both commands return version information, Rust is correctly installed and your environment is set up.

Editing shell config

If commands still are not found in new terminal windows, add Cargo to your shell startup file permanently.

For Bash or Zsh, add this line to ~/.bashrc or ~/.zshrc:

export PATH="$HOME/.cargo/bin:$PATH"

Then reload your shell config:

source ~/.bashrc
# or
source ~/.zshrc

This ensures every new shell session can find cargo and rustc.

Updating development environment

Once Rust is installed, it is a good idea to refresh rustup itself and the installed toolchain:

rustup self update
rustup update

This keeps the tool manager and compiler current and avoids stale metadata problems.

Rust project test

Create a sample Rust application and run it:

cargo new hello
cd hello
cargo run

This creates a new project, compiles it, and runs the default starter program. If everything is working, you should see output similar to:

Hello, world!

Troubleshooting developer environment

Problem: rust: command not found

Fix: The executable is not named rust. Use rustc for the compiler and cargo for builds and package management.

Problem: rustc: command not found or cargo: command not found

Fix: Run:

source $HOME/.cargo/env

Problem: Rust works in one shell but not another

Fix: Add Cargo to your shell startup file:

export PATH="$HOME/.cargo/bin:$PATH"

Problem: rustup says it needs newer data

Fix:

rustup self update
rustup update

These are the complete commands from the article:

sudo pacman -S rustup
rustup default stable
source $HOME/.cargo/env
rustc --version
cargo --version
export PATH="$HOME/.cargo/bin:$PATH"
rustup self update
rustup update
cargo new hello
cd hello
cargo run

That is the full install flow for Rust on Arch Linux using the recommended rustup-based setup.

Quality, Reliability & Service
Thank You For Visiting
Brooks Computing Systems - Jacksonville
Visit https://bcs.archman.us