Section: Environment variables

Change Cargo home

bash
bash
CARGO_HOME=$HOME/.cargo-alt cargo install ripgrep
Explanation

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
Enable Cargo debug logging
Emit tracing logs from Cargo itself.
OpenIn sheetbashsame section
Show a backtrace on panic
Display stack traces from Rust panics.
OpenIn sheetbashsame section
Pass custom compiler flags
Inject compiler flags for one build.
OpenIn sheetbashsame section
Set target dir by environment variable
Redirect build artifacts without editing config files.
OpenIn sheetbash2 tag match
Create project-local Cargo config
Store configuration in the project under `.cargo/config.toml`.
OpenIn sheettoml1 tag match
Build documentation
Generate docs for the package and dependencies.
OpenIn sheetbash1 tag match