1

I am new to programming and trying to install Rails on Mac Yosemite v10.10, but I get the following error when running $ gem install rails. How do I avoid this error and install rails?

ERROR: While executing gem ... (Errno::EACCES) Permission denied - /Users/usename/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/rails-4.1.7/README.md

I'm using ruby version 2.0.0p481.

4 Answers 4

4

You could make this:

sudo chown -R "$USER": ~/.rbenv

This function for me.

Sign up to request clarification or add additional context in comments.

Comments

1

Your rbenv installation was incorrectly installed as it had elevated privileges which caused your user account to not have write access to ~/.rbenv.

Do sudo chown -R pgrennin ~/.rbenv. This will take ownership of the directory

Comments

1

You probably accidentally installed rails with sudo before. This installed Rails files owned by root and not you, so now you can't update them. To fix this you'll have to repossess those files with chown:

sudo chown -R "$USER" ~/.rbenv

("$USER" is a variable that contains your username)

Comments

0

If using rbenv

rbenv local 2.0.0-p247 before gem install bundler

more reference : https://github.com/rbenv/rbenv#readme

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.