# How to install Rust on Windows To install the [[Rust]] toolchain on Windows. ## 1. Install MSVC build tools (pre-requisite) The default and recommended Rust toolchain on Windows is `stable-msvc`, which links against the Microsoft C++ build tools. You need them installed first or `rustc` will fail to link. Two options: 1. **Visual Studio (full IDE)**: https://visualstudio.microsoft.com/downloads/. During the installer, select: - Desktop development with C++ (mandatory) - .NET desktop development (optional) - Universal Windows Platform development (optional) 2. **Visual Studio Build Tools (no IDE, smaller)**: https://visualstudio.microsoft.com/visual-cpp-build-tools/. Pick the *Desktop development with C++* workload only. Lighter and sufficient for most Rust work. Either way, make sure the *Windows 11 SDK* (or 10 SDK) and the *MSVC v143 build tools* are checked. ## 2. Install rustup via winget (recommended) From PowerShell or `cmd.exe`: ```powershell winget install --id Rustlang.Rustup rustup default stable-msvc rustup update ``` [[Winget]] is the cleanest path on modern Windows. It tracks updates and is easy to script. ## 3. Alternative: official installer Download `rustup-init.exe` from https://rustup.rs/ and run it. Same end state as winget. ## 4. Verify ```powershell rustc --version cargo --version rustup show ``` ## Notes - If you also work in [[Windows Subsystem for Linux (WSL)]], install [[rustup]] separately *inside* the Linux distro. Toolchains are not shared between Windows and WSL. - The `stable-gnu` toolchain exists but rarely makes sense on Windows; stick with `stable-msvc` unless you have a specific MinGW use case. ## References - Official Microsoft setup guide: https://learn.microsoft.com/en-us/windows/dev-environment/rust/setup - rustup Windows MSVC pre-requisites: https://rust-lang.github.io/rustup/installation/windows-msvc.html - Visual Studio Build Tools: https://visualstudio.microsoft.com/visual-cpp-build-tools/ - winget package: https://winstall.app/apps/Rustlang.Rustup ## Related - [[Rust]] - [[rustup]] - [[Cargo (Rust)]] - [[Winget]] - [[Windows Subsystem for Linux (WSL)]]