Debian 13 is close enough to the current Rust stable release for some projects, but Debian 12 and 11 lag far enough behind that newer crates and upstream examples can drift out of sync. That difference matters when you install Rust on Debian for active development work. Rust gives you the compiler, while Cargo handles new projects, dependencies, builds, and tests from the same terminal workflow.
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 too, 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
This guide uses
sudofor system-wide package management. If your account does not have sudo access yet, run the commands as root or follow the guide on how to add a user to sudoers on Debian.
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.
| Method | Channel | Version | Updates | Best For |
|---|---|---|---|---|
| Debian APT | Debian packages | Debian 13: 1.85.x; Debian 12: 1.63.x; Debian 11: 1.48.x | APT-managed | Stable system integration, distro packaging parity |
| rustup | rustup.rs | Current stable | rustup update | Latest 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.
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.
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 still 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.
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
Enteror type1to accept the default stable toolchain. - Type
2if you want to customize the installation profile or default toolchain. - Type
3to 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 ~/.profile, so new login 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
On Debian 13 and 12,
apt autoremovecan remove GCC, LLVM, and other development packages that Rust pulled in. Skip it if you still use those toolchains 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 it added to ~/.profile.
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 login shell should also work because rustup adds . "$HOME/.cargo/env" to ~/.profile 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/1.1 200 OK
When that check succeeds, rerun the rustup installer.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Rust on Debian FAQ
Use rustup if you want the current stable compiler, upstream documentation that matches your local toolchain, or extra toolchains later. Use Debian APT if you want the distro-packaged Rust stack and are comfortable staying on the version branch your Debian release ships.
Debian 13 has the newest Rust branch in default APT sources at rustc 1.85.x. Debian 12 stays on rustc 1.63.x, and Debian 11 stays on rustc 1.48.x, which is why rustup is usually the better choice on those older releases.
No. The upstream Rust project supports Linux installs through rustup rather than a standalone Debian .deb package. On Debian, the packaged alternative is the distro’s own APT version of rustc and cargo.
Yes. rustup self uninstall removes both ~/.cargo and ~/.rustup, and it also removes the PATH line it added to ~/.profile. It does not delete project directories you created elsewhere, such as ~/hello-rust.
No. Debian APT installs Cargo alongside the compiler when you install rustc and cargo, and rustup includes Cargo in the default stable toolchain. If you already have Rust installed, check with cargo --version before reinstalling anything.
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, install CMake on Debian if a crate needs native libraries, and read The Rust Programming Language when you want a deeper walkthrough.
Formatting tips for your comment
You can use basic HTML to format your comment. Useful tags currently allowed:
<code>command</code>command<strong>bold</strong><em>italic</em><blockquote>quote</blockquote>