Rust is a systems programming language that combines memory safety with high performance. Unlike traditional systems languages, Rust eliminates entire categories of bugs such as null pointer crashes, data races, and buffer overflows at compile time without requiring a garbage collector. Additionally, built-in package management through Cargo, zero-cost abstractions, and seamless C interoperability make Rust practical for CLI tools, web services, embedded development, and WebAssembly projects where both safety and performance matter.
This guide walks through installing Rust on Linux Mint using rustup, the official installer and version manager maintained by the Rust project. You will install the complete Rust toolchain, verify the installation with a test project, add essential development tools like rustfmt and Clippy, and learn to manage updates and additional toolchains. By the end, you will have a working Rust development environment ready for building projects.
Choose Your Rust Installation Method
Linux Mint includes Rust packages in its repositories (inherited from Ubuntu), but these versions lag upstream releases significantly. For most developers, rustup provides the recommended path because it delivers the latest stable toolchain with straightforward updates. Before proceeding, review the table below to compare your options:
| Method | Channel | Version | Updates | Best For |
|---|---|---|---|---|
| rustup (Recommended) | rustup.rs | Latest stable, beta, or nightly | Manual via rustup update | Active development needing latest features, toolchain flexibility, and version switching |
| APT Repository | Linux Mint Repos | Stable (lags upstream) | Automatic via apt upgrade | Conservative stability requirements where older versions are acceptable |
For most Linux Mint users, rustup is the recommended path. It provides immediate access to the latest stable releases, toolchain flexibility for nightly features, and straightforward updates. However, if you specifically need APT integration for server environments or prefer automatic updates through the system package manager, the repository method works well for projects that do not require the latest language features.
Install Rust from Linux Mint Repositories
To install Rust using APT, run the following command which installs both the Rust compiler and Cargo package manager:
sudo apt install rustc cargo
After installation, verify the installed version:
rustc --version && cargo --version
rustc 1.75.0 cargo 1.75.0
Note that the APT version (1.75) lags behind the current rustup release (1.92+). If you need access to newer language features, async improvements, or the latest standard library additions, proceed with the rustup installation method below instead.
Install Rust Using rustup (Recommended)
For developers who need the latest stable toolchain, rustup provides the recommended installation path. Begin by updating your system before installation.
Update Linux Mint Before Installation
First, update your system to ensure all packages are current before installing Rust. This step refreshes your package index and upgrades existing packages, which prevents potential conflicts during installation:
sudo apt update && sudo apt upgrade
The first command refreshes the package list from repositories, while the second upgrades any outdated packages. As a result, running both ensures your system has the latest security patches and library versions before adding new software.
Install Required Build Tools
Although Rust itself installs pre-built binaries, many Rust crates (packages) contain native code that requires compilation. Therefore, install the essential build tools that these crates depend on:
sudo apt install -y curl build-essential pkg-config
This command installs curl for downloading the rustup installer, build-essential which provides the GCC compiler and related tools, and pkg-config which helps the build system locate installed libraries. Without these packages, compiling crates with native dependencies will fail with linker errors, so ensure they are installed before continuing.
Download and Run the rustup Installer
With prerequisites in place, download and execute the official rustup installer. This script is maintained by the Rust project and handles installing the Rust compiler, Cargo package manager, and associated tools:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
The --proto '=https' and --tlsv1.2 flags ensure the download uses secure HTTPS with TLS 1.2 or higher. After the script downloads, it displays an interactive menu with installation options:
Current installation options:
default host triple: x86_64-unknown-linux-gnu
default toolchain: stable
profile: default
modify PATH variable: yes
1) Proceed with standard installation (default - just press enter)
2) Customize installation
3) Cancel installation
Type 1 and press Enter to proceed with the default installation, which is appropriate for most users. Once you confirm, the installer downloads and installs the stable Rust toolchain, typically completing within 1-5 minutes depending on your internet connection.
Load Rust Environment Variables
Once installation completes, rustup adds Rust binaries to your PATH by modifying your shell profile (~/.bashrc or ~/.zshrc). To use Rust in your current terminal session without opening a new window, source the environment file:
source "$HOME/.cargo/env"
This command updates your current session’s PATH to include ~/.cargo/bin where Rust binaries are installed. Importantly, you only need to run this once per terminal session since new terminal windows will load the environment automatically.
Verify Rust Installation
Now confirm that Rust installed correctly by checking the compiler and package manager versions:
rustc --version
rustc 1.x.x (hash date)
Next, verify Cargo, the Rust package manager and build tool:
cargo --version
cargo 1.x.x
If either command returns “command not found,” run source "$HOME/.cargo/env" again to reload your PATH, or open a new terminal window.
Create a Test Rust Project
Beyond version checks, the best way to verify your Rust installation is to create and run a real project. Cargo simplifies this process by scaffolding a complete project structure with a single command:
cargo new hello-rust && cd hello-rust
This command creates a new directory called hello-rust containing a Cargo.toml manifest file (which defines your package name, version, and dependencies) and a src/main.rs source file with a basic “Hello, world!” program. In addition, Cargo initializes a Git repository and creates a .gitignore file automatically.
Next, compile and run the project:
cargo run
Compiling hello-rust v0.1.0 (/home/user/hello-rust)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.15s
Running `target/debug/hello-rust`
Hello, world!
The output shows Cargo compiling your project and then running the resulting binary. The compiled executable lives at target/debug/hello-rust and can be run directly without Cargo. Furthermore, subsequent builds are incremental, recompiling only changed files for faster iteration during development.
For release-optimized builds with full compiler optimizations, use:
cargo run --release
Release mode produces faster, smaller binaries but takes longer to compile. In general, use development builds for daily coding and reserve release builds for production deployments and performance testing.
Add Development Tools for IDE Integration
By default, the rustup installation includes rustfmt for code formatting and Clippy for linting. However, rust-analyzer, which powers IDE features like autocomplete and inline error checking, requires manual installation:
rustup component add rust-analyzer
With rust-analyzer installed, you now have access to all three essential development tools:
- rustfmt (pre-installed) automatically formats your code to match the official Rust style guidelines. Run it with
cargo fmtto format all files in your project. - Clippy (pre-installed) provides hundreds of linting rules that catch common mistakes, suggest idiomatic improvements, and identify potential performance issues. Run it with
cargo clippy. - rust-analyzer powers IDE features like autocomplete, inline error checking, and go-to-definition. If you use VS Code, install the rust-analyzer extension for full integration.
Finally, verify all components are available by listing 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
Manage Rust Toolchains and Updates
After installing Rust, you will need to keep your toolchain current and potentially manage multiple versions. The following commands apply to rustup installations; if you installed via APT instead, use standard package management commands.
Update Rust to Latest Version
Fortunately, rustup makes updating to the latest stable release straightforward. Simply run this command periodically to check for and apply updates:
rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: checking for self-update stable-x86_64-unknown-linux-gnu unchanged - rustc 1.x.x info: cleaning up downloads & tmp directories
This command checks for new versions across all installed toolchains (stable, beta, nightly) and updates them if newer versions are available. If you are already running the latest version, rustup reports “unchanged” as shown above.
Install Nightly or Beta Toolchains
Some Rust features are only available in nightly builds before they stabilize. To install the nightly toolchain alongside stable:
rustup toolchain install nightly
After installation, you can run commands with nightly without changing your default toolchain:
cargo +nightly build
To set nightly as your default toolchain (not recommended for most projects), use:
rustup default nightly
Switch back to stable with:
rustup default stable
List all installed toolchains to see what is available on your system:
rustup toolchain list
stable-x86_64-unknown-linux-gnu (default) nightly-x86_64-unknown-linux-gnu
Add Cross-Compilation Targets
Additionally, Rust supports cross-compilation to many architectures. To see all available targets, run:
rustup target list
To add a target for WebAssembly compilation, for example:
rustup target add wasm32-unknown-unknown
Once the target is added, compile for it with cargo build --target wasm32-unknown-unknown.
Troubleshooting Rust Installation
Command Not Found After Installation
If rustc or cargo return “command not found” after installation, your shell has not loaded the updated PATH. Source the environment manually:
source "$HOME/.cargo/env"
Alternatively, simply open a new terminal window. Since the rustup installer adds the source command to your shell profile automatically, new sessions will have Rust available without manual intervention.
Installer Hangs or Times Out
If the rustup installer stalls during download, check your internet connection first. If the connection is stable but installation still hangs, download the script manually and run it locally:
curl -o rustup-init.sh https://sh.rustup.rs && chmod +x rustup-init.sh && ./rustup-init.sh
Cargo Build Fails with Linker Errors
When cargo build fails with linker errors, it typically means the required build tools or library development packages are missing. A common error looks like:
error: linker `cc` not found | = note: No such file or directory (os error 2)
Another frequent error when building crates that depend on OpenSSL:
error: could not find native static library `ssl`, perhaps an -L flag is missing?
Install the missing prerequisites to resolve these errors:
sudo apt install -y build-essential pkg-config libssl-dev
After installing dependencies, clean the build cache and try again:
cargo clean && cargo build
Similarly, for crates that need specific libraries (like OpenSSL, SQLite, or graphics libraries), install the corresponding -dev packages. Always check the crate’s documentation for its system dependencies.
Version Conflict with APT-Installed Rust
If you previously installed Rust via APT and then installed rustup, you may have conflicting versions. Check which Rust binary your shell uses:
which rustc
For a rustup installation, the output should show your home directory:
/home/username/.cargo/bin/rustc
However, if the output shows /usr/bin/rustc instead, the APT version takes precedence. To fix this, remove the APT packages to use the rustup version:
sudo apt remove rustc cargo
Maintaining both installations creates confusion and version mismatches. Choose one method and remove the other.
Remove Rust from Your System
When you no longer need Rust, rustup provides a clean uninstall command that removes all toolchains and associated data:
rustup self uninstall
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)
Type y and press Enter to confirm. As a result, this command removes the ~/.rustup and ~/.cargo directories and also reverts the PATH modifications made during installation.
Uninstalling Rust does not remove projects you created. Your source code and compiled binaries in project directories remain intact. Only the Rust toolchain itself is removed.
Conclusion
Rust is now installed on your Linux Mint system with the complete toolchain, Cargo package manager, and essential development tools. Keep your installation current with rustup update and use cargo fmt and cargo clippy to maintain code quality. Start learning with The Rust Book for ownership and borrowing fundamentals, and explore the official documentation for standard library references and advanced features.
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.
Thanks for this clear instruction and easy install method. Linux all the way!