How to Install Rust on Debian 13, 12 and 11

Last updated Friday, May 22, 2026 7:53 am Joshua James 5 min read

Rust projects often follow upstream toolchain releases faster than Debian packages move, so the source you choose matters when you install Rust on Debian for active development. APT gives you a conservative system-managed Rust stack, while rustup tracks the current stable compiler and keeps Cargo aligned with upstream examples.

Debian does not install Rust by default, but both supported paths work on Debian 13 (trixie), Debian 12 (bookworm), and Debian 11 (bullseye). Rust is available in Debian’s default APT sources, and the official upstream Linux install path is rustup rather than a standalone Debian .deb. Both methods install Cargo, so you do not need a separate Cargo-only setup.

Install Rust on Debian

Start by refreshing APT metadata and applying any pending system updates before you choose a Rust toolchain.

sudo apt update && sudo apt upgrade

These commands use sudo for system-wide package management. If your account does not have sudo access yet, run the commands as root or add a user to sudoers on Debian first.

Rust is available through Debian’s own packages and through the official upstream toolchain manager. APT keeps the compiler under Debian’s package database, while rustup tracks the current stable release and makes it easier to add extra toolchains or targets later.

MethodChannelVersionUpdatesBest For
Debian APTDebian packagesDebian 13: 1.85.x; Debian 12: 1.63.x; Debian 11: 1.48.xAPT-managedStable system integration, distro packaging parity
rustuprustup.rsCurrent stablerustup updateLatest compiler, upstream docs, extra toolchains

For most developers, rustup is the better choice because it stays aligned with the current stable release and the official Rust documentation. APT is still a good fit when you want the Debian-packaged toolchain for system integration, packaging parity, or older project requirements.

Pick one method for a normal setup. Official rustup can coexist with Debian’s APT packages, but whichever rustc and cargo paths appear first in your shell will run. Remove the APT packages first if you want rustup to be the only active toolchain.

From Debian’s default APT sources, Debian 13 (trixie) ships rustc 1.85.0+dfsg3-1, Debian 12 (bookworm) ships rustc 1.63.0+dfsg1-2, and Debian 11 (bullseye) ships rustc 1.48.0+dfsg1-2. If you searched for how to install Cargo on Debian, both methods here install Cargo automatically alongside Rust.

Install Rust from Debian APT

Use APT when you want the Debian-packaged compiler and Cargo without a separate toolchain manager.

The Debian rustc package depends on GCC, libc development headers, and binutils, so a basic Cargo build has the linker tools it needs after the APT install finishes.

sudo apt install rustc cargo

Then check that both executables are available.

rustc --version && cargo --version

Debian 13 returns:

rustc 1.85.0 (4d91de4e4 2025-02-17) (built from a source tarball)
cargo 1.85.0 (d73d2caf9 2024-12-31)

On Debian 12, the same check returns rustc 1.63.0 and cargo 1.65.0. On Debian 11, it returns rustc 1.48.0 and cargo 1.46.0. On Debian 12 and 11, that Cargo CLI version is newer than the Debian package version string APT shows for the cargo package, and that mismatch is normal.

Install Rust with rustup on Debian

Use rustup when you want the current stable compiler, upstream documentation that matches your local toolchain, or the option to add more toolchains later.

Install the prerequisites first. Most Debian desktops already have ca-certificates, but server and minimal installs are the ones most likely to need the full set.

sudo apt install curl ca-certificates build-essential

The build-essential meta-package installs GCC, G++, and Make, which many Rust crates need when they compile native code during a build.

If your Rust projects also need a C or C++ build generator, install CMake on Debian separately.

The installer command uses curl with HTTPS-only and TLS 1.2 options. Review the curl command guide first if you want to understand those transfer flags before piping the installer into sh.

Run the official installer next. If you want the default stable toolchain, press 1 when the prompt appears.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

The installer stops at a short menu the first time it runs:

  • Press Enter or type 1 to accept the default stable toolchain.
  • Type 2 if you want to customize the installation profile or default toolchain.
  • Type 3 to cancel without changing the system.

A successful install ends with lines like these:

info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'
  stable-x86_64-unknown-linux-gnu installed - rustc 1.x.x (build-hash yyyy-mm-dd)

Rust is installed now. Great!

Load the environment file in the current shell so rustc and cargo work immediately without opening a new terminal.

source ~/.cargo/env

Rustup also adds the same line to shell startup files such as ~/.profile and ~/.bashrc when they exist, so new shells pick it up automatically.

Then verify the toolchain in the current shell.

rustc --version && cargo --version

A current stable install returns output like this:

rustc 1.x.x (build-hash yyyy-mm-dd)
cargo 1.x.x (build-hash yyyy-mm-dd)

Rustup tracks the current stable release, so the exact version numbers change over time.

Create a Test Rust Project on Debian

Cargo is the normal starting point for a Rust project, and this quick test works the same whether you installed Rust from APT or rustup.

cargo new hello-rust --bin
cd hello-rust
cargo run

A first run looks like this:

    Creating binary (application) `hello-rust` package
   Compiling hello-rust v0.1.0 (/home/your-user/hello-rust)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in x.xxs
     Running `target/debug/hello-rust`
Hello, world!

Update or Remove Rust on Debian

APT and rustup use different update and cleanup commands, so stick with the subsection that matches how you installed Rust.

Update Rust from Debian APT

If Rust came from Debian packages, update just the Rust packages instead of doing a full dist-upgrade.

sudo apt update && sudo apt install --only-upgrade rustc cargo

The --only-upgrade flag refreshes Rust only when those packages are already installed, so APT does not pull them onto a machine where you chose rustup instead.

Update Rust with rustup on Debian

If Rust came from rustup, let rustup refresh both the stable toolchain and the manager itself.

rustup update

A fully up-to-date system usually ends with:

info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: checking for self-update
info: cleaning up downloads & tmp directories

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.x.x (build-hash yyyy-mm-dd)

Remove Rust from Debian APT

Purge the Debian packages first.

sudo apt purge rustc cargo

If APT now marks compiler dependencies as unused and you do not need them for other work, remove them separately.

sudo apt autoremove

apt autoremove can remove LLVM, Rust standard libraries, debugger helpers, and other development packages that Rust pulled in. Skip it if you still use those packages for other projects.

Refresh APT metadata and confirm both packages show Installed: (none).

sudo apt update
apt-cache policy rustc cargo
rustc:
  Installed: (none)
  Candidate: x.x.x
  Version table:
     x.x.x 500
        500 http://deb.debian.org/debian [your-release]/main amd64 Packages
cargo:
  Installed: (none)
  Candidate: x.x.x
  Version table:
     x.x.x 500
        500 http://deb.debian.org/debian [your-release]/main amd64 Packages

APT shows package versions in this output, not the version strings printed by cargo --version. The important part is Installed: (none) for both packages.

Remove Rustup on Debian

Rustup includes its own uninstaller and removes the toolchain directories it created.

rustup self uninstall

Type y when the prompt appears.

Thanks for hacking in Rust!

This will uninstall all Rust toolchains and data, and remove
$HOME/.cargo/bin from your PATH environment variable.

Continue? (y/N) y

info: removing rustup home
info: removing cargo home
info: removing rustup binaries
info: rustup is uninstalled

Rustup leaves project directories such as ~/hello-rust alone, so remove those separately if you no longer want them. It also removes the . "$HOME/.cargo/env" line from the shell startup files it modified.

If rustc still resolves after the uninstall, Debian’s APT packages are still installed and you should use the APT removal steps above as well.

To confirm the toolchain directories are gone:

for path in ~/.cargo ~/.rustup; do
  [ -e "$path" ] && echo "still present: $path" || echo "removed: $path"
done
removed: /home/your-user/.cargo
removed: /home/your-user/.rustup

Troubleshoot Rust on Debian

These checks cover the two issues that most often block a fresh rustup install on Debian: a missing PATH update and broken CA certificates on minimal systems.

Fix rustup PATH issues on Debian

If rustc or cargo says command not found after a rustup install, the current shell usually has not loaded ~/.cargo/bin yet.

bash: rustc: command not found

Check whether the Rust binary directory is already in your PATH.

echo "$PATH" | tr ':' '\n' | grep -Fx "$HOME/.cargo/bin"
/home/your-user/.cargo/bin

If that command returns nothing, load the environment file in the current shell.

source ~/.cargo/env

Then verify the toolchain again.

rustc --version && cargo --version
rustc 1.x.x (build-hash yyyy-mm-dd)
cargo 1.x.x (build-hash yyyy-mm-dd)

A new shell should also work because rustup adds . "$HOME/.cargo/env" to shell startup files such as ~/.profile and ~/.bashrc during installation.

Fix rustup SSL certificate errors on Debian

If the installer cannot validate HTTPS, Debian is usually missing current CA certificates.

curl: (60) SSL certificate problem: unable to get local issuer certificate

Reinstall the certificate bundle first.

sudo apt update && sudo apt install --reinstall ca-certificates

Then confirm the installer URL returns a normal HTTPS response.

curl -fsSI https://sh.rustup.rs | head -n 1
HTTP/2 200

When that check succeeds, rerun the rustup installer.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Conclusion

Rust is ready on Debian with either the distro-packaged toolchain or the current stable release from rustup. Start your next project with cargo new, install Git on Debian to track your code, and read The Rust Programming Language when you want a deeper walkthrough.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show more of our fresh Linux tutorials in Top Stories and From your sources when relevant.

Add LinuxCapable as a preferred source on Google
Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffeeBuy me a coffee
Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: