Sam*_*are 4 macos terminal rust
我正在尝试通过运行以下命令来安装Rust:
sudo curl https://sh.rustup.rs -sSf | sh
Run Code Online (Sandbox Code Playgroud)
我一直收到以下错误:
could not write rcfile file: '/Users/pro/.bash_profile'
info: caused by: Permission denied (os error 13
Run Code Online (Sandbox Code Playgroud)
nba*_*ari 12
尝试使用不使用sudo:
curl https://sh.rustup.rs -sSf | sh -s -- --help
Run Code Online (Sandbox Code Playgroud)
如果有效,那么你可能会尝试:
curl https://sh.rustup.rs -sSf | sh -s -- --no-modify-path
Run Code Online (Sandbox Code Playgroud)
Has*_*sef 12
接受的答案仅在工作终端会话中对我有效,重新启动我的 MacBokk Air 后不起作用。
与我合作的解决方案是:
// Opened .bash_profile file, I used VS code as editor, this the `code` below
Hasans-Air:~ h_ajsf$ sudo code $HOME/.bash_profile
// Add the below to the .bash_profile file
PATH=$PATH:/Users/$USER/.cargo/bin
//Saved the file
//Updated env by:
Hasans-Air:~ h_ajsf$ source $HOME/.bash_profile
//Check for JAVA_HOME
Hasans-Air:~ h_ajsf$ rustup
Run Code Online (Sandbox Code Playgroud)
更新
如图所示:
听起来运行安装脚本的用户没有权限/不是 ~/.bash_profile 的所有者,这是不寻常的。也许纱线应该检查并且更有帮助,但无论如何,运行
sudo chownwhoami可能是个好主意~/.bash_profile
所以,我尝试了以下命令:
sudo chown h_ajsf ~/.bash_profile
Run Code Online (Sandbox Code Playgroud)
而一切都顺利完成。