Permission Error When Trying to Install Rails (Osx)

Permission Error When Trying To Install Rails (OSX)

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

Issue the following command in order to take of ownership of the directory:

 sudo chown -R Russell_Silver ~/.rbenv

Note that some users may have a different rbenv directory, e.g. /usr/local/var/rbenv. This would take the place of ~/.rbenv in the above command.

Why do I get a permission denied error while installing a gem?

Your Ruby is installed in /usr/local/Cellar/ruby/....

That is a restricted path and can only be written to when you use elevated privileges, either by running as root or by using sudo. I won't recommend you run things as root since you don't understand how paths and permissions work. You can use sudo gem install jekyll, which will temporarily elevate your permissions, giving your command the rights needed to write to that directory.

However, I'd recommend you give serious thought into NOT doing that, and instead use your RVM to install Ruby into your own home directory, where you'll automatically be able to install Rubies and gems without permission issues. See the directions for installing into a local RVM sandbox in "Single-User installations".

Because you have RVM in your ~/.bash_profile, but it doesn't show up in your Gem environment listing, I suspect you either haven't followed the directions for installing RVM correctly, or you haven't used the all-important command:

rvm use 2.0.0 --default

to configure a default Ruby.

For most users, the "Single-User installation" is the way to go. If you have to use sudo with that configuration you've done something wrong.

Error installing rails - permission denied when running 'gem install rails'

You could make this:

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

This function for me.



Related Topics



Leave a reply



Submit