LinuxCommandLibrary

rustup-install

Install and manage Rust toolchains

TLDR

View documentation for the original command

$ tldr rustup toolchain
copy

SYNOPSIS

sh.rustup.rs | sh [OPTIONS]
or
rustup-init.sh [OPTIONS]

PARAMETERS

--default-toolchain <toolchain>
    Sets the default toolchain to be installed and used. Examples: stable, beta, nightly, 1.70.0.

--profile <profile>
    Specifies the installation profile. Options include: minimal (just rustc and cargo), default (common components), and complete (all components like clippy, rustfmt, etc.).

--no-modify-path
    Prevents rustup from modifying the system's PATH environment variable. Users will need to manually add `~/.cargo/bin` to their PATH.

--target <target-triple>
    Installs the standard library for a specific target triple (e.g., x86_64-unknown-linux-gnu for Linux, x86_64-apple-darwin for macOS). Multiple targets can be specified by repeating this option.

--no-host
    Prevents installation of the host platform's standard library. Useful when only cross-compilation targets are needed.

--verbose
    Enables verbose output during the installation process, showing more details about what rustup is doing.

--quiet
    Suppresses most output messages, showing only critical information or prompts.

--force
    Forces the installation even if rustup is already installed, overwriting existing files.

--help
    Displays a help message with available options for rustup-init.sh.

DESCRIPTION

The term rustup-install typically refers to the internal script or process that performs the initial installation of the Rust toolchain, including the Rust compiler (rustc), Cargo (Rust's package manager), and rustup itself. It is usually invoked by the user-facing `rustup-init.sh` script, which is the primary method for users to install Rust. Users do not generally run `rustup-install` directly.

rustup is the official installer and version manager for Rust. It allows developers to manage multiple Rust toolchains, switch between them, and update them easily. This includes stable, beta, and nightly releases, as well as specific versions and custom builds. The installation process typically involves downloading the `rustup-init.sh` script (often via `curl | sh`), which then fetches and executes the necessary components, including the internal `rustup-install` logic, to set up the Rust environment on your system. It also manages the PATH environment variable to make `rustc`, `cargo`, and `rustup` available in the terminal.

CAVEATS

rustup-install is an internal component of the rustup installation process; it is not intended for direct user invocation. Users should use rustup-init.sh.

The installation requires an active internet connection to download toolchain components. Disk space requirements vary based on the selected profile and installed targets.

Modifying the PATH environment variable requires appropriate shell configuration (e.g., `~/.bashrc`, `~/.zshrc`). Rustup attempts to do this automatically, but manual intervention might be necessary depending on the shell and system setup.

ENVIRONMENT VARIABLES

RUSTUP_HOME: Specifies the directory where rustup stores toolchains and data. Defaults to `~/.rustup`.
CARGO_HOME: Specifies the directory for Cargo's global cache and binaries. Defaults to `~/.cargo`.
RUSTUP_TOOLCHAIN: Can be used to override the active toolchain for a specific shell session or directory.

POST-INSTALLATION STEPS

After installation, it's common to run `source $CARGO_HOME/env` (or `source ~/.cargo/env`) in your current shell or add it to your shell's configuration file (e.g., `~/.bashrc`, `~/.zshrc`) to ensure `rustc`, `cargo`, and `rustup` are in your PATH. The installer typically prompts to do this automatically upon completion.

HISTORY

rustup was created to provide a robust and flexible way to install and manage Rust toolchains, addressing the need for easy switching between stable, beta, and nightly releases, as well as managing components like `rustfmt` and `clippy`. It was initially developed by Brian Anderson and has become the de facto standard for Rust installation since its early days, evolving significantly over time to improve reliability, performance, and user experience.

SEE ALSO

rustup(1), cargo(1), rustc(1)

Copied to clipboard