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

Hello,

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 https://sh.rustup.rs | sh -s -- --default-toolchain 1.67.0 -y
export PATH=$PATH:$HOME/.cargo/bin
bash $HOME/.cargo/env

Thanks!

Best, Oliver

Have a look at https://rust-lang.github.io/rustup/installation/index.html#choosing-where-to-install; you can set the RUSTUP_HOME and CARGO_HOME variables before running rustup, and they will be used by the installer.

3 Likes

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.