错误
使用rustup在Linux服务器上安装Rust时,有时会出现以下错误,导致无法正确安装:
error: could not amend shell profile: '/home/ubuntu/.bashrc'
error: caused by: could not write rcfile file: '/home/ubuntu/.bashrc'
error: caused by: Permission denied (os error 13)
或者
error: could not amend shell profile: '/home/ubuntu/.profile'
error: caused by: could not write rcfile file: '/home/ubuntu/.profile'
error: caused by: Permission denied (os error 13)

这是由于.profile
和.bashrc
的权限不允许写入所导致的。
解决
只需给上述提到的文件加入权限即可。将修改为777权限,即在对应目录运行chmod 777 .profile
和chmod 777 .bashrc
,之后再运行rustup,问题得以解决。

mac也适用,感谢!🙏