Getting "error: could not amend shell profile: Permission denied" installing rustup using recommended command

1.8k Views Asked by At

I tried installing Rust using the below command, which is recommended by https://rustup.rs/ for Unixes:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

but getting an error

error: could not amend shell profile: '/Users/XXXX/.bash_profile'
       could not write rcfile file: '/Users/XXXX/.bash_profile'
       Permission denied (os error 13)

However, I am using zsh not bash.

1

There are 1 best solutions below

0
On

Your home directory seems to not be editable which crashes the installer.

There seems to be a fix for this discussed in a rustup repo issue. Append -s -- -y --no-modify-path to bash:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
bash -s -- -y --no-modify-path

Alternatively, you could give write permission to the path that couldn't be edited, or run this command with sudo.