rustup: rustup is not creating $HOME/.cargo/env
I don’t want $HOME/.cargo/env being sourced in my $HOME/.profile or my $HOME/.bashrc.
Still, it is convenient to have $HOME/.cargo/env generated since I will source this file anyway under certain circumstances.
However, $HOME/.cargo/env is not created when I perform the installation as shown below
$ curl https://sh.rustup.rs -sSf | sh -s -- --no-modify-path -y
Bug or feature?
Thanks a lot,
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 6
- Comments: 15 (5 by maintainers)
On a side note, when rustup is not creating the
$HOME/.cargo/envfile, it still shows the following message:which is kind of confusing since the file does not exist.
I think I agree that it’s a bug we’re not writing the env file out on
--no-modify-path- I’m working on a test (and from there a fix) right now.I fully second this! In my case the issue I have is that in some continuous integration system, the
.bashrcfile is not writable by rustup because of some permission reasons so I need to rely on--no-modify-pathbut at the same time I want to manually callsource $HOME/.cargo/envlater on.@detly :: The issue was already fixed but it was not released yet.
Meanwhile, you can simply reinstall Rust and copy the env file somewhere else so that you can source it yourself. However, when you try to reinstall Rust, you may eventually find a problem: the env file may not be created.
This happens because rustup detects that your $HOME/.profile and $HOME/.bashrc have already been changed. Simply edit your $HOME/.profile and $HOME/.bashrc and remove the line in the end which sources your env file at $HOME/.cargo/env.
Then run rustup once again like shown below and it should create $HOME/.cargo/env.
Note: I have a shell script which installs Rust and several cargo plugins which circumvents this trouble. I simply create $HOME/.cargo/env by hand via this bash function: