2

I am trying to install Rust via the command line on a Windows VM (https://github.com/sansyrox/robyn/pull/263). The script on the main Rust installation website only supports *nix os.

What are the commands to download and install Rust on a Windows VM?

4
  • There's a link that goes to the the other installation page that has Windows-specific methods. Commented Aug 19, 2022 at 20:36
  • @wkl , all of them want you to use the gui installer. From what I can understand. Commented Aug 19, 2022 at 20:42
  • You can use Chocolatey, Scoop, and the page also links you to rustup. None of these require GUI installers. Commented Aug 19, 2022 at 20:46
  • @wkl , what will be the command to install everything from cli? Becase a simple curl or a wget doesn't work. Commented Aug 20, 2022 at 16:55

2 Answers 2

3

Install it with scoop for easier package management on your system with a single command:

GNU toolchain

scoop install rustup-gnu
rustup toolchain install stable-x86_64-pc-windows-gnu
rustup default stable-x86_64-pc-windows-gnu

or

scoop install rustup for MSVC toolchain

Then you can update rustup or uninstall it whenever you want with:

scoop upgrade rustup

scoop uninstall rustup.

Sign up to request clarification or add additional context in comments.

Comments

2

Follow directions in Other ways to install rustup. Download rustup-init.exe based on the target toolchain of your choice:

You can use --help to see what options there are to configure the installation:

> .\rustup-init.exe --help
rustup-init 1.24.3 (ce5817a94 2021-05-31)
The installer for rustup

USAGE:
    rustup-init.exe [FLAGS] [OPTIONS]

FLAGS:
    -v, --verbose                        Enable verbose output
    -q, --quiet                          Disable progress output
    -y                                   Disable confirmation prompt.
        --no-update-default-toolchain    Don't update any existing default toolchain after install
        --no-modify-path                 Don't configure the PATH environment variable
    -h, --help                           Prints help information
    -V, --version                        Prints version information

OPTIONS:
        --default-host <default-host>              Choose a default host triple
        --default-toolchain <default-toolchain>    Choose a default toolchain to install
        --profile <profile>                         [default: default]  [possible values: minimal, default, complete]
    -c, --component <components>...                Component name to also install
    -t, --target <targets>...                      Target name to also install

The basic -y should work for you; it will install rustup and the default toolchain. You can of course use wget to download the installer within a script.

> wget https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe
> .\rustup-init.exe -vy

Note, the MSVC toolchain will require you to install the Visual C++ Build Tools to function. I'm unsure how to install those in a CLI only environment. Hopefully the .exe for that functions similarly.

See also:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.