Install Cargo, Rust, etc, but not in $HOME


I have a script that installs Rust and Cargo, to then build and install my own app. Unfortunately, on the system I'm running this, $HOME is in a rather small disk, and the installer puts Rust and Cargo inside $HOME, and I run out of disk space. Can I tell the installer to put it somewhere else? My script does the installation like this:

curl --proto '=https' --tlsv1.2 -sSf | sh -s -- --default-toolchain 1.67.0 -y
export PATH=$PATH:$HOME/.cargo/bin
bash $HOME/.cargo/env


Best, Oliver

Have a look at; you can set the RUSTUP_HOME and CARGO_HOME variables before running rustup, and they will be used by the installer.


Awesome, thanks, that's it! I couldn't find that somehow.

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.