Cargo and Rustup are no more responding in MacOS

In Mac, I defined an env var as below:

$ nano .bash_profile
>> export ANDROID_HOME=/Users/Jerry/Library/Android/sdk
$ source .bash_profile

After this change, both cargo and rustup are given command not found

47%20PM

$ ANDROID_HOME=/ cargo --version
cargo 1.39.0-nightly (3f700ec43 2019-08-19)

Maybe something else in the .bash_profile broke it?

I think rustup sets the path in ~/.profile, but per its manpage, bash "looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable."

So if you didn't have ~/.bash_profile before, its presence now takes priority.

2 Likes

Thanks, I removed everything I added into ~/.bash_profile so it is empty now, and I added what I want into ~/.profile
Then I run:

$ source .bash_profile
$ source ~/.profile

Both cargo and rustup are working in the same terminal only not in any other one, and once I close this terminal, they are not working any more, tell I repeat the source ~/.profile!

Do you not need to remove the actual file then as per @cuviper 's comment?

Thank, I run

$ rm ~/.bash_profile

And everything is back to original now.