Setting up Rust on Windows 10 with MSYS2 without installing Visual Studio
1. Install MSYS2
2. Update MSYS2 and run : pacman -Sy && pacman -Syu and install git and gcc: pacman -S git && pacman -S mingw-w64-x86_64-toolchain
3. Open the MSYS2 terminal and install the rust compiler with : pacman -S mingw-w64-x86_64-rust
You may stop here but you will miss the rustup package (which is not part of MSYS2) to manage the Rust compiler environment. To install rustup, follow the next steps.
4. Clone the rustup git repository :
git clone git@github.com:rust-lang/rustup.git --depth=1
5. Compile and run rustup:
cd rustup
cargo run --release
6. Once rustup detects the previously installed rust compiler and asks to uninstall it before you can continue. So, open a new MSYS2 terminal and uninstall rust : pacman -R mingw-w64-x86_64-rust
7. Now back to the rustup terminal, choose yes to continue the installation.
On the next question choose : custom installation and chose as host triple : x86_64-pc-windows-gnu
Now, press ENTER to finish the setup
Commentaires
If you get "command not found" when running step 5, make sure you are starting MSYS2 using the "MinGW-w64 64-bit Shell" shortcut.