1

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?

kmdreko
  • 42,554
  • 6
  • 57
  • 106
Sanskar Jethi
  • 544
  • 5
  • 17
  • There's a link that goes to the [the other installation page](https://forge.rust-lang.org/infra/other-installation-methods.html) that has Windows-specific methods. – wkl Aug 19 '22 at 20:36
  • @wkl , all of them want you to use the gui installer. From what I can understand. – Sanskar Jethi Aug 19 '22 at 20:42
  • You can use Chocolatey, Scoop, and the page also links you to [rustup](https://forge.rust-lang.org/infra/other-installation-methods.html#other-ways-to-install-rustup). None of these require GUI installers. – wkl Aug 19 '22 at 20:46
  • @wkl , what will be the command to install everything from cli? Becase a simple curl or a wget doesn't work. – Sanskar Jethi Aug 20 '22 at 16:55

2 Answers2

0

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:

kmdreko
  • 42,554
  • 6
  • 57
  • 106
0

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

scoop install rustup-gnu for GNU toolchain

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.

adamency
  • 682
  • 6
  • 13