I dont wanna install rustup in /home directory

I dont wanna install rustup in /home/$USER/.cargo/, then I downloaded the tar.gz package and installed it into /usr, now the IntelliJ-Rust reports Can not attach stdlib sources automatically without rustup. So is there any solution about

  • Where is stdlib will be installed in?
  • Can I just install rustup in the directory in where I wanna install?
  • Can I just install rustup with the existence of rust in /usr/local/bin?

You may want to look into how the Arch Linux rustup package does this.

1 Like

You need to set the RUSTUP_HOME variable to change where the .rustup folder goes.

The path you mentioned is for cargo though, I'm not sure if that can be changed, from memory there's a few problems doing so, believe there is an outstanding github issue on the matter.


You need to set both RUSTUP_HOME and CARGO_HOME. I've been doing this in Windows for awhile without issue (the default of installing things in the root of the Users directory is annoying in Windows).

1 Like

I successfully installed as my wish on Ubuntu, but failed on macOS, do you have any ideas about it?

You will need to be a bit more specific about what "failed" before people can offer pointers for troubleshooting.

The fail means it was not installed in the location I specified.