Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "could not amend shell profile" when HOME is unwritable #2040

Closed
jeroen opened this issue Oct 5, 2019 · 4 comments

Comments

@jeroen
Copy link

commented Oct 5, 2019

Problem

When CARGO_HOME and RUSTUP_HOME point to a location outside of $HOME, the rustup installer still tries to write to $HOME/.profile and then errors with:

error: could not amend shell profile: '/Users/builder/.profile'
info: caused by: could not write rcfile file: '/Users/builder/.profile'
info: caused by: Permission denied (os error 13)

I can't find how to prevent rustup from touching the user .profile or proceed with installation even though it fails to update .profile.

Steps

We run rustup on a somewhat restricted and perishable MacOS 10.11 virtual machine where user $HOME is unwritable. Hence on each build, we need to install cargo like so:

export CARGO_HOME="${TMPDIR}/.cargo"
export RUSTUP_HOME="${TMPDIR}/.rustup"
curl https://sh.rustup.rs -sSf | bash -s -- -y

And then in another script, we can use the following command to build stuff:

CARGO_HOME=${TMPDIR}/.cargo RUSTUP_HOME=${TMPDIR}/.rustup  \
  ${CARGO_HOME}/bin/cargo build --release --manifest-path=myrustlib/Cargo.toml

This works, but the rustup installation error about $HOME/.profile keeps showing.

Possible Solutions

  1. A variable or option to opt-out of automatically updating the user .profile.
  2. Turn this into a warning instead of an error, such that installation can proceed.

Notes

  • System: MacOS 10.11
  • Rustup: latest
@jeroen jeroen added the bug label Oct 5, 2019
@kinnison

This comment has been minimized.

Copy link
Collaborator

commented Oct 6, 2019

You probably want to pass --no-modify-path to the installer.

@jeroen

This comment has been minimized.

Copy link
Author

commented Oct 6, 2019

Thanks. Where do I pass this exactly? Like so ?

curl https://sh.rustup.rs -sSf | bash -s -- -y --no-modify-path
@kinnison

This comment has been minimized.

Copy link
Collaborator

commented Oct 6, 2019

Yep that's exactly right. The --no-modify-path is equivalent to telling the interactive installer that you don't want it to try and alter your profile. It will still write the env file to CARGO_HOME for you to use.

@jeroen

This comment has been minimized.

Copy link
Author

commented Oct 7, 2019

Thanks!

@jeroen jeroen closed this Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.