"Permission denied" error when trying to install Ruby


#1

In step 3.1 of the Installing Ruby section of Web Dev 101, I’m supposed to execute the following command in Terminal:

echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

However, when I try to do this I keep getting the following error:

-bash: /Users/aet/.bash_profile: Permission denied

Does anyone have any ideas why this could be? Thanks!


#2

You might get this error if you are trying to “execute” .bash_profile without a command. Can you confirm whether or not you copy/pasted the command, or if you tried typing it instead?


#3

I tried copy/pasting and typing, and I got “Permission denied” both times


#4

You can try opening .bash_profile with a text editor and inserting eval "$(rbenv init -)" manually at the end of your file.


#5

I tried editing it manually, but the file was locked. I fixed it using the top-level answer from this Stack Overflow thread:

Thanks!