Search code examples
macosterminalrust

Could not write to .bash_profile when installing Rust on macOS Sierra


I am trying to install Rust by running the following:

sudo curl https://sh.rustup.rs -sSf | sh

I keep getting this following error:

could not write rcfile file: '/Users/pro/.bash_profile'
info: caused by: Permission denied (os error 13

Solution

  • Give a try using this not using sudo:

    curl https://sh.rustup.rs -sSf | sh -s -- --help
    

    If that works then probably you could try:

    curl https://sh.rustup.rs -sSf | sh -s -- --no-modify-path 
    

    If the command with the --no-modify-path option works, you'll have to manually update .bash_profile to include it in your path:

    source ~/.cargo/env