Rails: Your User Account Isn't Allowed to Install to the System Rubygems

rbenv bundle install tries to install gems into wrong path

I just had the same problem and this solved it for me:

gem uninstall bundler
gem update --system
rbenv rehash
gem install bundler

Most likely only gem update --system were mandatory.

How to install a gem or update RubyGems if it fails with a permissions error

You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.

means exactly that, you don't have permission to write there.

That is the version of Ruby installed by Apple, for their own use. While it's OK to make minor modifications to that if you know what you're doing, because you are not sure about the permissions problem, I'd say it's not a good idea to continue along that track.

Instead, I'll strongly suggest you look into using either rbenv or RVM to manage a separate Ruby, installed into a sandbox in your home directory, that you can modify/fold/spindle/change without worrying about messing up the system Ruby.

Between the two, I use rbenv, though I used RVM a lot in the past. rbenv takes a more "hands-off" approach to managing your Ruby installation. RVM has a lot of features and is very powerful, but, as a result is more intrusive. In either case, READ the installation documentation for them a couple times before starting to install whichever you pick.

Rubygems issue when runnuing rails new

Ok, here is how I solved it for reference. I saw the a similar issue in this thread

A step by step solution would be:

  1. Run gem env. You should see a list of paths like so under GEM PATHS:

    /Library/Ruby/Gems/2.0.0

    /Users/sam/.gem/ruby/2.0.0

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0

  2. Open your ~/.bashrc file and add the paths as follows:

    export GEM_HOME=/Library/Ruby/Gems/2.0.0

    export PATH=$PATH:$GEM_HOME:/Users/sam/.gem/ruby/2.0.0:/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0

  3. Open a new shell and run the gem install rubygems-update. Everything should run fine now without sudo.



Related Topics



Leave a reply



Submit