Skip to main content
The recommended way to install Rust is through rustup, the official Rust installer and version management tool.
Read the full installation guide in The Rust Book for detailed instructions.

Quick Install

Open your terminal and run:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
This will download and run the rustup installer. Follow the on-screen instructions.

Verifying Installation

After installation, verify Rust is installed correctly:
rustc --version
You should see output like:
rustc 1.xx.x (xxxxxxx 20xx-xx-xx)

Updating Rust

Keep Rust up to date with rustup:
rustup update

Uninstalling Rust

If you ever need to uninstall Rust:
rustup self uninstall

Installing from Source

Building Rust from source is not recommended unless you know what you’re doing. Most users should use rustup instead.
The Rust build system uses a Python script called x.py to build the compiler, which manages the bootstrapping process.

Prerequisites

Before building from source, ensure you have the required dependencies installed.
Required dependencies:
  • Python 3 or 2.7
  • Git
  • A C compiler (e.g., gcc or clang)
  • curl (not needed on Windows)
  • pkg-config (Linux only)
  • OpenSSL development headers (libssl-dev or openssl-devel)
Optional for building LLVM from source:
  • g++, clang++, or MSVC
  • ninja or GNU make 3.81 or later
  • cmake 3.13.4 or later

Build Steps (Unix/Linux/macOS)

1

Clone the repository

git clone https://github.com/rust-lang/rust.git
cd rust
2

Configure the build

Run the interactive setup:
./x.py setup
This will guide you through selecting a configuration profile and setting up your development environment.Alternatively, use the configure script for advanced configurations:
./configure --enable-full-tools \
  --enable-profiler \
  --enable-sanitizers
3

Build and install

./x.py build && ./x.py install
This will install rustc, rustdoc, and by default, Cargo into $PREFIX/bin.
You can disable Cargo installation by passing --set build.extended=false to configure.

Build Steps (Windows - MSVC)

1

Install prerequisites

  • Install Visual Studio 2022 with “C++ build tools” workload
  • Install Python, CMake, and Git (see Prerequisites tab above)
2

Clone and configure

git clone https://github.com/rust-lang/rust.git
cd rust
python x.py setup user
3

Build

python x.py build

Build Steps (Windows - MinGW)

1

Install MSYS2

Download and install MSYS2
2

Install Git for Windows

Download Git for Windows and ensure it’s in your PATH.
3

Install build tools

Open a MINGW64 shell and run:
# Update package mirrors
pacman -Sy pacman-mirrors

# Install build tools (for 64-bit)
pacman -S make diffutils tar \
  mingw-w64-x86_64-python \
  mingw-w64-x86_64-cmake \
  mingw-w64-x86_64-gcc \
  mingw-w64-x86_64-ninja
For 32-bit, replace x86_64 with i686 in the package names.
4

Build and install

python x.py setup dist && python x.py build && python x.py install

Platform Support

Rust supports a wide variety of platforms. Since the compiler is written in Rust, it must be built by a precompiled “snapshot” version of itself.
Source builds require an internet connection to fetch snapshots, and an OS that can execute the available snapshot binaries.
See the Rust Platform Support page for:
  • Tier 1 platforms (guaranteed to work)
  • Tier 2 platforms (guaranteed to build)
  • Tier 3 platforms (experimental support)
Only platforms with “host tools” have pre-compiled snapshot binaries. To compile for platforms without host tools, you must cross-compile.

Building Documentation

If you’re building from source and want to build the documentation:
./x.py doc
The generated documentation will appear in the build/<triple>/doc directory, where <triple> is your build target (e.g., x86_64-pc-windows-msvc).

Next Steps

Now that you have Rust installed, check out the Quick Start Guide to write your first Rust program.

Build docs developers (and LLMs) love