How to Install Rust on Linux Mint 22 and 21

Install Rust on Linux Mint 22.x and 21.x with rustup or APT. Covers Cargo checks, updates, toolchains, and removal.

Last updatedAuthorJoshua JamesRead time7 minGuide typeLinux Mint

When you install Rust on Linux Mint, you add a compiler that catches memory and concurrency mistakes early, plus Cargo for building and managing projects. That matters when you are building native CLI tools, backend services, WebAssembly projects, or other low-level software where performance still matters.

rustup is the official Rust installer for Linux Mint, and a default install also gives you Cargo without a separate package. The APT packages are still useful when you want Linux Mint to manage Rust through normal package updates. Either path leaves you with a working compiler, Cargo, and a small project you can build right away.

Install Rust on Linux Mint

Linux Mint gives you two practical ways to install Rust. rustup uses the official installer and keeps stable, beta, and nightly toolchains close at hand. The repository method uses Mint’s default APT packages, which trade newer releases for tighter package-manager integration.

MethodChannelVersionUpdatesBest For
rustup (Recommended)rustup.rsCurrent stable, beta, or nightlyManual with rustup updateActive development, fast updates, and switching toolchains per project
APT RepositoryDefault APT repositoriesAPT-packaged stable branchSystem updates or sudo apt install --only-upgrade rustc cargoSystem-managed packages and simpler APT-based maintenance

rustup is the better starting point for most development work because it follows the current upstream stable toolchain. The default APT packages on current Linux Mint 22.x and 21.x releases stay on an older packaged branch, which is useful for system-managed workflows but less flexible for active development.

Pick one primary method for day-to-day terminal work. Keeping both APT Rust packages and rustup on the same Mint install can leave /usr/bin/rustc ahead of ~/.cargo/bin in your PATH, so the shell keeps using the older packaged compiler until you remove it or change the shell order.

Install Rust with rustup on Linux Mint

Use rustup when you want the official Rust installer for Linux Mint, quick updates, and the option to add nightly or beta toolchains later without replacing Mint packages by hand. The Rust project does not publish a Mint-specific .deb, so rustup is the upstream install path on Linux Mint.

Start by refreshing package metadata:

sudo apt update

If your account still needs administrative access, create and add users to sudoers on Linux Mint before continuing.

Next, install the packages that the rustup installer and many native crates rely on. On a typical Mint desktop, the curl command is often already there, but install GCC on Linux Mint and add pkg-config support before you start compiling crates that depend on system libraries.

sudo apt install curl build-essential pkg-config

build-essential provides the C compiler, linker, and runtime development files that Cargo needs for native builds, including the hello-world project later in this workflow on minimal or customized Mint installs. pkg-config helps crates find installed libraries such as OpenSSL, SQLite, or GTK.

If you already tested the APT method on this Mint system, remove rustc and cargo before switching to rustup. The installer can continue with both present, but the older /usr/bin binaries often stay ahead of ~/.cargo/bin in your PATH.

Run the official installer next:

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

The --proto and --tlsv1.2 checks keep the download on HTTPS. The sh -s -- -y portion passes -y to the installer so it accepts the standard install without waiting for an interactive menu.

Load Rust into the current shell so you can use it right away:

source "$HOME/.cargo/env"

rustup adds the . "$HOME/.cargo/env" loader line to shell startup files such as ~/.profile and ~/.bashrc, so new terminal sessions can find the Rust commands automatically after installation.

Verify the rustup installation:

rustc --version && cargo --version
rustc 1.96.0 (ac68faa20 2026-05-25)
cargo 1.96.0 (30a34c682 2026-05-25)

Install Rust from Linux Mint repositories

Choose the APT method when you want Mint to manage Rust with ordinary package updates and you do not need the newest compiler branch on day one. Install the compiler, Cargo, and the native build tools needed by the project test later in this workflow:

sudo apt update
sudo apt install rustc cargo build-essential pkg-config

Check the versions Mint installed:

rustc --version && cargo --version
rustc 1.75.0 (82e1608df 2023-12-21) (built from a source tarball)
cargo 1.75.0

On current Mint 22.x and 21.x systems, the repository channel resolves to an older packaged branch than rustup. That is stable enough for many packaged workloads, but it trails the upstream stable toolchain by several releases.

Build a Test Rust Project on Linux Mint

A quick project build proves more than a version check because it exercises Cargo, the compiler, and the local linker in one pass.

cargo new hello-rust && cd hello-rust

When Git is already installed, Cargo also initializes a repository for the new project. If you still need that toolchain, install Git on Linux Mint before you start versioning your Rust work, then configure your Git username and email so the first commit uses the identity you expect.

Compile and run the sample project:

cargo run --quiet
Hello, world!

If you want Cargo to show the compile steps as well, run the same command without --quiet. Use cargo run --release when you want an optimized build instead of the default developer profile.

Add Rust Development Tools with rustup on Linux Mint

The component commands in this section apply to rustup installs. The default rustup profile already installs Cargo, Clippy, rustc, and rustfmt. Add rust-analyzer if you want autocomplete, inline diagnostics, and jump-to-definition support in editors such as VS Code; if you still need that editor, install VS Code on Linux Mint before configuring the Rust extension.

rustup component add rust-analyzer

Check the installed toolchain components:

rustup component list --installed
cargo-x86_64-unknown-linux-gnu
clippy-x86_64-unknown-linux-gnu
rust-analyzer-x86_64-unknown-linux-gnu
rust-docs-x86_64-unknown-linux-gnu
rust-std-x86_64-unknown-linux-gnu
rustc-x86_64-unknown-linux-gnu
rustfmt-x86_64-unknown-linux-gnu

Three everyday commands are worth using early: cargo fmt formats the crate, cargo clippy flags common mistakes and style issues, and cargo test runs the test suite defined in your project.

Manage Rust Updates and Toolchains on Linux Mint

Rust maintenance depends on how you installed it, so use the matching update path instead of mixing rustup and APT commands.

Update Rust installed with rustup on Linux Mint

rustup updates every installed toolchain in one pass:

rustup update
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.96.0 (ac68faa20 2026-05-25)

Update Rust installed with APT on Linux Mint

If you chose the repository packages, let Mint handle routine upgrades through normal system maintenance or upgrade only Rust and Cargo when you want a narrower change set:

sudo apt install --only-upgrade rustc cargo

Run rustc --version afterwards if you want to confirm that Mint moved you to a newer packaged branch.

Install a Nightly Rust Toolchain on Linux Mint

The nightly toolchain is useful when a crate depends on unstable features or you want to test the next compiler line without replacing stable:

rustup toolchain install nightly

List the toolchains now available on your system:

rustup toolchain list
stable-x86_64-unknown-linux-gnu (active, default)
nightly-x86_64-unknown-linux-gnu

Remove the nightly toolchain later if you only needed it for testing:

rustup toolchain uninstall nightly

Add a Rust Cross-Compilation Target on Linux Mint

Cross targets let one Mint machine build binaries for another platform or runtime. WebAssembly is a common first example:

rustup target add wasm32-unknown-unknown

Confirm that rustup installed the target:

rustup target list --installed | grep '^wasm32-unknown-unknown$'
wasm32-unknown-unknown

Run the build command from an existing Cargo project when you are ready to compile for WebAssembly:

cargo build --target wasm32-unknown-unknown --quiet

Remove the target later if the project no longer needs it:

rustup target remove wasm32-unknown-unknown

Fix Common Rust Issues on Linux Mint

Most install problems come down to shell PATH loading or mixing the Mint packages with rustup. These checks keep the diagnosis short.

Fix Rust command not found on Linux Mint

If your current shell prints an error such as bash: rustup: command not found, bash: rustc: command not found, or bash: cargo: command not found right after installation, the profile change has not been loaded into that session yet.

source "$HOME/.cargo/env"

Verify that the shell can now use the toolchain:

rustup --version && rustc --version && cargo --version

Relevant output includes:

rustup 1.29.0 (28d1352db 2026-03-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
rustc 1.96.0 (ac68faa20 2026-05-25)
cargo 1.96.0 (30a34c682 2026-05-25)

Fix APT and rustup version conflicts on Linux Mint

When both installation methods are present, rustup can report an active stable toolchain while Mint still runs the older /usr/bin/rustc binary from APT.

Compare the compiler version with the rustup toolchain status:

rustc --version && rustup show active-toolchain
rustc 1.75.0 (82e1608df 2023-12-21) (built from a source tarball)
stable-x86_64-unknown-linux-gnu (default)

If rustc --version reports the older APT compiler while rustup shows a newer stable toolchain, remove the APT packages, clear Bash’s command cache, and reload the shell environment:

sudo apt remove rustc cargo
hash -r
source "$HOME/.cargo/env"

Retest the active compiler path:

rustc --version && rustup show active-toolchain
rustc 1.96.0 (ac68faa20 2026-05-25)
stable-x86_64-unknown-linux-gnu (default)

Remove Rust from Linux Mint

Use the removal command that matches the method you installed. rustup and APT manage different files, so one command does not clean up the other.

Remove Rust installed with rustup on Linux Mint

This command removes the rustup-managed toolchains, the Cargo home, and the shell startup lines rustup added. The -y flag skips the confirmation prompt.

rustup self uninstall -y
info: removing rustup home
info: removing cargo home
info: removing rustup binaries
info: rustup is uninstalled

rustup removes its . "$HOME/.cargo/env" loader lines from the shell startup files it managed. It does not remove your project directories, so crates like hello-rust remain in place.

Remove Rust installed from Linux Mint repositories

APT users can remove the compiler and package manager with the standard package command:

sudo apt remove rustc cargo

Keep build-essential and pkg-config if you compile other software on this Mint system. If you installed those prerequisite packages only for Rust and no longer need local build tools, remove them separately:

sudo apt remove build-essential pkg-config

Confirm that Mint no longer sees those packages as installed:

apt-cache policy rustc cargo
rustc:
  Installed: (none)
  Candidate: 1.75.0+dfsg0ubuntu1-0ubuntu7.4
  Version table:
     1.75.0+dfsg0ubuntu1-0ubuntu7.4 500
        500 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages
     1.75.0+dfsg0ubuntu1-0ubuntu7 500
        500 http://archive.ubuntu.com/ubuntu noble/main amd64 Packages
cargo:
  Installed: (none)
  Candidate: 1.75.0+dfsg0ubuntu1-0ubuntu7.4
  Version table:
     1.75.0+dfsg0ubuntu1-0ubuntu7.4 500
        500 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages

On Mint 21.x, the same verification block still shows Installed: (none), but the current candidate is 1.75.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04.1 from jammy-updates and jammy-security instead of the noble packages shown above.

If APT reports additional libraries are no longer required, remove them with sudo apt autoremove only when you know nothing else on the system depends on them.

Next Steps With Rust on Linux Mint

Rust is installed on Linux Mint with a tested build path, whether you chose rustup or Mint’s APT packages. If you used rustup, keep rust-analyzer wired into your editor, then use the Rust Book as you move from a hello-world crate to larger projects.

Share this guide

Help another Linux user troubleshoot faster

Share this guide with someone troubleshooting Linux systems or saving it for later.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show our tutorials more often in Top Stories and mark them as preferred in AI Mode and AI Overviews 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

2 thoughts on “How to Install Rust on Linux Mint 22 and 21”

  1. Clear ans simple instructions. Worked as expected.
    The instructions align with those on the rust website, but with some Linux Mint specific additions, like making sure that prerequisites like gcc, make, curl and make are installed.

    If you are a programmer, you may have these installed already but it’s nice to have them in the instructions. This is particularly true because this install rust outside the normal apt process for installing on debian/ubuntu.

    After installing, I recommend a book like ‘Programming Rust’ by Blandy & Orendorff from O’Reilly publishing. There are plenty of tutorials online and at various training sites.

    Reply
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
<a href="https://example.com">link</a> link
<blockquote>quote</blockquote> quote block

Add to the discussion

Questions, fixes, command output, and version notes help keep this guide current.

Verify before posting: