December 14, 2019

[NOTE] Rust install on Windows in non-default path

Default paths for Rust are:
C:\Users\kkim\.cargo\bin
C:\Users\kkim\.rustup

To change this, just set up environment variables.
  1. Open https://www.rust-lang.org/tools/install
  2. Download rustup-init.exe
  3. Open cmd in the same directory where the download executable is.
  4. Set up environment variables as shown below and run the installer. 
    Remember to set these two env vars in system properties, not just within CMD.  These vars are needed as it's non-default locations.
  [email protected] E:\Downloads\2019-12-01
> set CARGO_HOME=c:\opt\rust\cargo

[email protected] E:\Downloads\2019-12-01
> set RUSTUP_HOME=c:\opt\rust\rustup

[email protected] E:\Downloads\2019-12-01
> rustup-init.exe

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

It will add the cargo, rustc, rustup and other commands to
Cargo's bin directory, located at:

  c:\opt\rust\cargo\bin

This can be modified with the CARGO_HOME environment variable.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  c:\opt\rust\rustup

This can be modified with the RUSTUP_HOME environment variable.

This path will then be added to your PATH environment variable by
modifying the HKEY_CURRENT_USER/Environment/PATH registry key.

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:


   default host triple: x86_64-pc-windows-msvc
     default toolchain: stable
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>2

I'm going to ask you the value of each of these installation options.
You may simply press the Enter key to leave unchanged.

Default host triple?


Default toolchain? (stable/beta/nightly/none)


Profile (which tools and data to install)? (minimal/default/complete)
complete

Modify PATH variable? (y/n)
y


Current installation options:


   default host triple: x86_64-pc-windows-msvc
     default toolchain: stable
               profile: complete
  modify PATH variable: yes


1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

info: profile set to 'complete'
info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
info: latest update on 2019-11-07, rust version 1.39.0 (4560ea788 2019-11-04)
warning: Force-skipping unavailable component 'lldb-preview-x86_64-pc-windows-msvc'
warning: Force-skipping unavailable component 'miri-x86_64-pc-windows-msvc'
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'llvm-tools-preview'
info: downloading component 'rls'
info: downloading component 'rust-analysis'
info: downloading component 'rust-docs'
 11.8 MiB /  11.8 MiB (100 %)  11.4 MiB/s in  1s ETA:  0s
info: downloading component 'rust-src'
info: downloading component 'rust-std'
180.7 MiB / 180.7 MiB (100 %)  12.0 MiB/s in 15s ETA:  0s
info: downloading component 'rustc'
 41.4 MiB /  41.4 MiB (100 %)  12.1 MiB/s in  3s ETA:  0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'llvm-tools-preview'
 10.5 MiB /  10.5 MiB (100 %)   7.3 MiB/s in  1s ETA:  0s
info: installing component 'rls'
info: installing component 'rust-analysis'
info: installing component 'rust-docs'
 11.8 MiB /  11.8 MiB (100 %) 649.6 KiB/s in  1m 13s ETA:  0s
info: installing component 'rust-src'
  2.5 MiB /   2.5 MiB (100 %) 781.3 KiB/s in  3s ETA:  0s
info: installing component 'rust-std'
180.7 MiB / 180.7 MiB (100 %)  16.8 MiB/s in 14s ETA:  0s
info: installing component 'rustc'
 41.4 MiB /  41.4 MiB (100 %)   8.6 MiB/s in  5s ETA:  0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable'

  stable installed - rustc 1.39.0 (4560ea788 2019-11-04)


Rust is installed now. Great!

To get started you need Cargo's bin directory (c:\opt\rust\cargo\bin) in your
PATH
environment variable. Future applications will automatically have the
correct environment, but you may need to restart your current shell.

Press the Enter key to continue.

No comments:

Post a Comment