How to choose not to install certain components in `rustup toolchain install`

I use internet to read docs and I don't want to include docs in every toolchain.

For local toolchain

rustup toolchain install nightly --profile minimal
  • The minimal profile includes as few components as possible to get a working compiler (rustc, rust-std, and cargo). It's recommended to use this component on Windows systems if you don't use local documentation (the large number of files can cause issues with some Antivirus systems), and in CI.

For changing the current toolchain

rustup set profile minimal

For project toolchain

# rust-toolchain.toml
channel = "version"
components = [ "rustfmt" ]
profile = "minimal"

For the first time installing Rust

It's also possible to choose the profile when installing rustup for the first time, either interactively by choosing the "Customize installation" option or programmatically by passing the --profile=<name> flag. Profiles will only affect newly installed toolchains: as usual it will be possible to install individual components later with: rustup component add .

How do I "apply" profile changes (remove components that no need) to my current installation?

rustup component remove xxx

$ rustup component --help
Modify a toolchain's installed components

    rustup component <SUBCOMMAND>

    -h, --help    Prints help information

    list      List installed and available components
    add       Add a component to a Rust toolchain
    remove    Remove a component from a Rust toolchain
    help      Prints this message or the help of the given subcommand(s)

Can I only manually remove components one by one?

You can also do

rustup set profile minimal
rustup component add xxx

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.