Search This Blog

Install Rust on Windows 10 with msys2

  • Install MSYS2
  • Update MSYS2 packages by executing
    pacman -Sy
    pacman -Syu
    in MSYS2 Terminal
  • Install git and mingw-w64-x86_64-toolchain in MSYS2 terminal:
    pacman -S git
    pacman -S mingw-w64-x86_64-toolchain
  • Install mingw-w64-x86_64-rust in MSYS2 terminal:
    pacman -S mingw-w64-x86_64-rust
    Now the rust compiler is installed. You can stop here if you do not need rustup to manage the Rust compiler environment.
  • To use rustup, clone the git repository:
    git clone https://github.com/rust-lang/rustup.git
  • Compile and run rustup:
    cd rustup
    cargo run --release
    Rustup will detects the previous install rust compiler and asks to uninstall it before you can continue. You need to open a new MSYS2 terminal and run
    pacman -R mingw-w64-x86_64-rust
    and then go back to the rustup installation terminal, choose yes to continue the installation.
    On the next question choose: Custom installation and chose as host triple: x86_64-pc-windows-gnu
  • After rustup installation, the cargo command will be install to $HOME/.cargo/bin. You will need to install it in your PATH environment variable.

No comments:

Post a Comment