Rails: Your user account isn't allowed to install to the system RubyGems Rails: Your user account isn't allowed to install to the system RubyGems ruby ruby

Rails: Your user account isn't allowed to install to the system RubyGems


In my case, I solved doing just what the error message suggests:

Your user account isn't allowed to install to the system RubyGems.  You can cancel this installation and run:      bundle install --path vendor/bundle  to install the gems into ./vendor/bundle/

So, instead of:

bundle install

I ran:

bundle install --path vendor/bundle

That was the solution for this guy.

The downside of that solution is that it creates a vendor folder inside the current folder, which can be added to .gitignore if it is to distribute the application through Git.


Usually if you're using RVM, rbenv or chruby to install Ruby, all the gems will be installed in your home folder under ~/.rbenv/ruby-version/...

If you're using your system Ruby though (the one that is installed by default) the gems are installed alongside it in a location that you don't have access to without sudo.

My guess would be that your version manager defaults to the system Ruby but some of your projects have a .ruby-version file in them that tells it to use a different version of Ruby which you have access to.


I had a similar experience. I would have simply ran the code below to fix it temporarily

bundle install --path vendor/bundle

The downside to this is that it does not solve the issue permanently, as the issue will re-surface when you start out with other Ruby on Rails Applications.

I tried this solution, but it did not work for me:

Display a list of all your local gems for the bundler gem

gem list bundler

N/B: The command above is for rbenv version manager, the one for rvm might be different

This will display the versions of the bundler gem installed locally

bundler (2.0.2, default: 1.17.3, 1.10.6)

And then ran the code below below to uninstall version 1.10.6

gem uninstall bundler

Afterwhich I ran the code below to rehash rbenv

rbenv rehash

However, this did not solve the issue.

Here's how I solved it;

The issue was that I mistakenly ran a bundle install operation with administrative rights, that is:

sudo bundle install

which made the owner of the ~/.rbenv OR ~/.rvm directory to become root

To solve the issue I ran the code below to change the ownership of the files and directories.

For rbenv users:

sudo chown -R $USER  ~/.rbenv

And for RVM users

sudo chown -R $USER  ~/.rvm

That's it.

I hope this helps