In Rust, by default, files are placed in $HOME/.cargo and $HOME/.rustup. Is there any way to override these defaults?
I am trying to debug an obscure issue and I want to try changing the file locations.
This is explained in the documentation:
rustupallows you to customise your installation by setting the environment variablesCARGO_HOMEandRUSTUP_HOMEbefore running therustup-initexecutable. As mentioned in the Environment Variables section,RUSTUP_HOMEsets the root rustup folder, which is used for storing installed toolchains and configuration options.CARGO_HOMEcontains cache files used by cargo.
Don't forget to update the $PATH or you won't be able to use the binaries. Also, if you want that setup to be permanent, export those variables from your shell configuration (e.g. .bashrc or .zshrc):
Note that you will need to ensure these environment variables are always set and that
CARGO_HOME/binis in the$PATHenvironment variable when using the toolchain.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With