Understanding the rustup Installer
What rustup is, why it exists, how it manages Rust toolchains, and how the installer works before you run platform-specific commands.
If you have ever installed a programming language, you know that getting the compiler and tools set up correctly can be the hardest part. Rust solves this problem with a single tool called rustup. The rustup installer is the official and recommended way to install and manage Rust on your computer. This page explains what rustup actually is, what it does behind the scenes, and what you can expect when you run the installer. By the time you finish reading, you will understand the whole installation philosophy so that the actual commands for your operating system make complete sense.
What Problem rustup Solves
Before rustup, installing Rust meant downloading a single version of the compiler for your platform and hoping it worked. If you wanted to try a newer version, you had to uninstall and reinstall. If a project required an older version, you were stuck. Different platforms also had different installation methods, which made documentation confusing.
Rust has a rapid release cycle: a new stable version appears every six weeks. There are also beta and nightly releases that come out even more frequently. To keep up with that, developers needed a way to switch between versions, update effortlessly, and install extra tools like code formatters and linters.
rustup solves all of this. It is a toolchain manager, a program whose only job is to install, update, and organize different versions of the Rust compiler and its associated tools on your machine. Think of it like a version manager for Node.js (nvm) or Python (pyenv), but built specifically for Rust and distributed by the official Rust project.
What rustup Actually Installs
When you run the rustup installer, you are not just installing one program. You are installing a small ecosystem that lives in a dedicated folder on your computer. That ecosystem contains three main pieces, all of which you will use constantly as an Axum developer:
- rustc - the Rust compiler. This is what turns your
.rssource code into an executable program. - cargo - the Rust package manager and build tool. It downloads dependencies, compiles your project, runs tests, and much more.
- rustup itself - the manager that updates rustc and cargo, installs additional components, and switches between versions.
Together, rustc and cargo form a toolchain. A toolchain is a set of tools that work together to build Rust programs. rustup manages one or more toolchains on your machine. You can have a stable toolchain for normal work, a beta toolchain for testing upcoming features, and a nightly toolchain for experimenting with bleeding-edge functionality. All of them are installed side by side, switchable with a single command.
The Directory Structure
rustup splits its files across two folders in your home directory. The toolchain manager itself lives in .rustup (on Linux and macOS ~/.rustup, on Windows %USERPROFILE%\.rustup), while Cargo's home is .cargo (~/.cargo, or %USERPROFILE%\.cargo on Windows). Inside ~/.rustup you will find:
toolchains/- where each installed toolchain is storedsettings.toml- rustup's configuration (default toolchain, directory overrides, profile)
Inside ~/.cargo you will find:
bin/- where the actual executable files live (rustc,cargo,rustup)env- a small shell file that addsbin/to yourPATHwhen your shell startsregistry/- where package information from crates.io is cached
The installer also modifies your PATH environment variable so that you can type rustc or cargo in a terminal from any directory. PATH is simply a list of folders your operating system searches when you run a command. If .cargo/bin is in that list, your terminal will find the Rust tools.
Why the PATH change matters:
If after installation you open a new terminal and type rustc but get "command not found", the most likely reason is that the PATH change has not taken effect yet. Restart your terminal, log out and back in, or start a new shell session.
What a Toolchain Contains
A toolchain is more than just rustc. It also includes the standard library (the collection of pre-written code that every Rust program can use), the cargo build tool, and sometimes additional components. Components are optional pieces that extend the toolchain. Some common components are:
- rustfmt - automatically formats your code according to Rust style guidelines
- clippy - a linter that catches common mistakes and suggests improvements
- rust-docs - offline documentation for the standard library
rustup can install these components into any toolchain you have. For example, if you want clippy available in your stable toolchain, you run rustup component add clippy. That command tells rustup to download and attach the clippy component to the currently active stable toolchain.
Another concept is targets. By default, rustc compiles for your own operating system and architecture (for example, Linux x86_64 or macOS ARM). But you can also cross-compile, which means building a program that runs on a different platform. rustup manages these additional targets too, installing them on demand.
Release Channels
Rust is developed in three main channels:
- Stable - the version most people should use. It is reliable, tested, and released every six weeks.
- Beta - the upcoming stable release, used for testing before promotion. New features have been implemented but not yet fully stabilized.
- Nightly - built automatically every night from the latest source code. It contains experimental features that may change or break.
rustup can install toolchains from any channel. For example, you can have stable, beta, and nightly installed at the same time. You switch between them with commands like rustup default stable or rustup default nightly. The default command tells rustup which toolchain to use when you run rustc or cargo without specifying one.
Nightly is not for daily work:
Beginners sometimes install the nightly channel thinking it gives them the newest features. While true, nightly is unstable and can break without warning. For learning Axum, always use the stable channel unless a specific feature requires otherwise. You can always add nightly later if needed.
How the rustup Installer Works
The rustup installer itself is a small program or script that sets everything up. Conceptually, it goes through a sequence of steps. Understanding these steps will prepare you for what you see when you run the actual command on your operating system.
Step 1: Download the installer
The installer is a single file: either a shell script for Unix-like systems (macOS, Linux, WSL) or an executable for Windows. For Unix-like systems, you often download and run it in one command using curl, which fetches the script from https://sh.rustup.rs and pipes it directly into your shell. For Windows, you download rustup-init.exe and double-click it.
Step 2: Configure installation options
When the installer runs, it asks a few questions. Usually you can just press Enter to accept the defaults. The most common question is whether to proceed with the default installation or customize it. For beginners, always choose the default. The installer then figures out your operating system and architecture automatically.
Step 3: Install the rustup binary
rustup places its own executable in the .cargo/bin folder and makes sure that folder exists. It also modifies your shell's startup file (like .bashrc, .zshenv, or the Windows registry) so that the .cargo/bin directory is added to your PATH. This is how your terminal will find the Rust commands later.
Step 4: Download the default toolchain
rustup then downloads the default toolchain, which is the latest stable version of Rust. This includes rustc, cargo, the standard library, and the rust-std component. The download can take a few minutes depending on your internet speed.
Step 5: Verify the installation
The installer finishes by telling you that Rust is installed and how to check it. It might suggest running rustc --version to confirm. If you see a version number, everything worked.
The whole process is designed to be as simple as possible. You do not need to manually download a compiler, set environment variables, or compile anything yourself. rustup handles all of that.
Getting the Installer: The Two Main Paths
There are two official ways to start the rustup installation, and they depend on your operating system. This section gives you the general commands so you understand what they look like.
Unix-like systems (macOS, Linux, WSL)
On any system that uses a Unix-like shell (Terminal on macOS, a terminal on Linux, or Windows Subsystem for Linux), you run a single command that downloads the rustup installation script and executes it:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Let's break that down so it doesn't look like magic:
curlis a command-line tool for downloading files from the internet.--proto '=https'forces the connection to use HTTPS, so the download is encrypted.--tlsv1.2specifies a secure version of the TLS protocol (the technology behind HTTPS).-sSfmeans: be silent (-s) but show errors (-S), and fail fast (-f) if there is a problem.https://sh.rustup.rsis the URL of the official installation script.| shtakes the output ofcurl(the script content) and passes it tosh, the shell interpreter that runs the script.
In other words, you are downloading a program and immediately running it, all in one step. This is the most common way for Unix-like users to install Rust.
Do not run the Unix script on native Windows:
The command above works only in Unix-like environments such as macOS, Linux, or WSL. If you are on native Windows using Command Prompt or PowerShell, you must download and run rustup-init.exe instead. Running the script in PowerShell will not work because PowerShell is not a Unix shell.
Windows systems
On Windows, you have two official options:
- Download the installer executable: Go to
https://rustup.rsand downloadrustup-init.exefor your architecture (x64 or ARM64). Double-click the file and follow the on-screen instructions. The installer will guide you through the same steps as the script. There is no 32-bit installer: starting with Rust 1.100.0, the Rust project no longer ships a compiler that runs on 32-bit Windows, so a toolchain cannot be installed on a 32-bit Windows machine. - Use Windows Subsystem for Linux (WSL): If you have WSL set up, you can open a WSL terminal and use the same
curlcommand as on Linux. This installs Rust inside the WSL environment, not on native Windows.
The choice depends on how you plan to develop. If you will use a native Windows terminal and tools, use the .exe installer. If you prefer a Linux-like environment on Windows, use WSL. Both are valid, and rustup works the same in either case.
Download the correct rustup-init.exe from the official site and run it. The installer will detect your system and offer default settings. Accept the defaults unless you have a specific reason to change them. You may be prompted to install the Visual Studio C++ Build Tools; do so if asked, because Rust on Windows needs them to compile programs.
No matter which path you choose, the end result is identical: rustup is installed, a default stable toolchain is downloaded, and your PATH is updated.
What You See After Installation
When the installer finishes successfully, you will see a message similar to this (exact text may vary):
Rust is installed now. Great!
To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).
To configure your current shell, run:
source "$HOME/.cargo/env"
That last line is important if you want to use Rust immediately in the current terminal without opening a new one. It tells your current shell to read the PATH changes that rustup made. Running source "$HOME/.cargo/env" (or the Windows equivalent) will make the Rust commands available right away.
Success looks like a version number:
After installing, open a new terminal and run rustc --version. If you see something like rustc 1.100.0 (0ef1bc386 2026-11-09), installation succeeded. If you get an error saying the command was not found, the PATH change has not taken effect. Restart your terminal or run the source command shown in the installer output.
rustup vs Package Managers
Many operating systems have their own package managers (like apt on Debian/Ubuntu, brew on macOS, or winget on Windows). These can sometimes install Rust, but that is not the recommended way. Here is why:
- Package managers often have older versions of Rust that lag behind the official releases.
- They may split rustc and cargo into separate packages, causing version mismatches.
- They usually cannot install multiple toolchains or easily switch between channels.
- They do not integrate with rustup's component and target management.
The official Rust project strongly recommends using rustup as the only way to install Rust. If you already have Rust installed via a package manager, you should remove it before running the rustup installer to avoid confusion.
Avoid mixing installation methods:
If you install Rust via apt and then later run rustup, you may end up with two different versions of rustc on your system, and your terminal may pick the wrong one. Always uninstall any package-manager Rust before using rustup. This is one of the most common causes of "it installed but it's using the old version" problems.
Common Misconceptions
"rustup is the Rust compiler"
No. rustup is the manager. It downloads and installs the compiler (rustc) for you. If someone says "install Rust," they usually mean "install rustup, which will install the Rust toolchain."
"Installing Rust means I get the latest nightly"
No. The default installation gives you the latest stable toolchain. Stable is the recommended channel for all beginners and for most production work. Nightly is an opt-in choice.
"I need to install rustc and cargo separately"
No. rustup installs both together as part of a toolchain. You do not download them independently. This is one of the main benefits of rustup.
"rustup only works on Linux"
No. rustup works on Windows, macOS, Linux, and many other platforms. The installer is different (script vs executable) but the functionality is identical.
What You Can Do with rustup (High-Level Overview)
Once rustup is installed, it stays in charge of your Rust tools for as long as you use them. When a new Rust release comes out, rustup fetches it and replaces the old toolchain while keeping your projects intact. When a project needs a different Rust version, rustup switches to it for that project without disturbing the rest of your machine. When you need to build for another platform, or want the formatter and linter added to a toolchain, rustup fetches those pieces too. Everything in this page so far, the channels, the components, the targets, and the two home folders, exists so that this one manager can keep every Rust version you use organised in one place.
Summary
The rustup installer is the entry point to the Rust ecosystem. It solves the problem of managing multiple compiler versions and components across platforms. The decision framework is short. If you are on macOS or Linux, run the official install command and accept the defaults. If you are on Windows, download rustup-init.exe and accept the defaults, after installing the Visual Studio Build Tools so the linker is present. In every case, use the stable channel and the default profile unless you have a concrete reason to do otherwise, and install through rustup rather than a system package manager, so one manager owns every Rust version on your machine.
The single idea to carry forward is that rustup, not any single compiler install, is what you maintain. The compiler and Cargo are parts of a toolchain that rustup downloads, updates, and switches between. Once you think of it that way, the platform-specific install commands are just different ways of putting the same manager on your machine.