Rust-lang install on macos 12.6 somehow went bad

OKAY, so basically i started the install process for rust-lang on my macbook pro runing monterey 12.6. somewhere along the way im not sure exactly what i did but basically i get a response very similar if not exactly the same response each time i try to move forward with Rust. Here is an example of the error messages i get. Basically im trying to install rustlings and this is what i get. Okay i wasnt able to reproduce exactly what i wanted but i tried to do this "rustup doc --book" and the response i get from my terminal is this

error: could not create home directory: '/.rustup': Read-only file system (os error 30)

Does anyone have any ideas as to what might be going on and possibly could suggest a fix?

I'm really eager to learn Rust so im hoping somone can make a suggestion fast cause so far im leaning towards doing a full factory reset. I'm just making some changes to another laptop so it has the room to backup my files.

I also realize that i didnt provide anyone with too much information but its because i dont have a clue where exactly i went wrong. However, that being said if anyone has any questions i am way more than willing to try and answer them. i really wanna fix this.

Can you try re-running the rustup installer script as indicated here and see what happens if you use the default installation method?

Also make sure you're not running it as root.

Okay so its allowing to pick whether i want to do a normal or custom install. should i allow it to go forward?

Try normal and see what happens

this is what it spit back at me.

  1. Proceed with installation (default)
  2. Customize installation
  3. Cancel installation

1

error: could not create bin directory: '/.cargo/bin': Read-only file system (os error 30)

sorry added a little more for context.

It seems like for some reason it has concluded that your home directory is the root of the filesystem (hence the paths it is failing to create right under /) which indeed will not work because that area is permanently not writable (and shouldn't be written to, either, if you want your rustup installation to work normally).

Could you try

echo $HOME

in your terminal and tell us what it prints? If that is wrong then that could explain the problem.

2 Likes

well im not sure if this actually helps but here is what it returned.

/Users/fau57

That's a bit weird, to say the least.

Could you try rebooting the machine? And then try the installer again?

sure just gimme a second

Okay so i got the exact same error after a full power down and reboot so something somewhere is registering as sudo but i have no idea what or where. Any ideas on how to hunt it down?

Can you check if you have the RUSTUP_HOME env variable set for some reason?

where would i find that exactly?

echo $RUSTUP_HOME from the same terminal you ran the installer script from

this is what it spit back

/.rustup```

I don't know how it happened, but your terminal seems to think that your home dir is / rather than /Users/fau57. This is pretty much always wrong.

Basically it looks like your user account is broken pretty badly.

Here's how you can verify that:

  1. Create a new user, perhaps via the graphical system user settings
  2. Log into that account
  3. Try to install rust there using the script from https://rust-lang.org

If that works, your current user profile is broken and it might be best to migrate your data to the new profile, and purge the old one.

Oh that's a really interesting work around, thank you, I don't think I would have figured that out as an option. I'm currently backing up all my important stuff in case I have to do a complete factory reset.

Well there's the culprit. Somewhere that env var is getting set and it shouldnt be

Is there a way I could attempt to track it down?

It will depend on your shell, among other things.

you can check your home folder for .bashrc .zshrc and .bash_profile for RUSTUP_HOME lines

You can also see if the install succeeds by temporarily overridding the variable when you run the installer

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

That will only override it for the current shell session though, so if you open another terminal window you may still have issues interacting with the installed tools until you fix whatever is setting RUSTUP_HOME originally