Use a non-default cache and install location.
Section: Environment variables
Change Cargo home
bash
bash
CARGO_HOME=$HOME/.cargo-alt cargo install ripgrepExplanation
Cargo home stores downloaded dependencies and install state.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Environment variables
Set target dir by environment variable
Redirect build artifacts without editing config files.
Create project-local Cargo config
Store configuration in the project under `.cargo/config.toml`.