0

When I create a new rails app using rails new Test, I am getting the following error.

run  bundle install


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/, or you can enter your password
and install the bundled gems to Rubygems using sudo.

I have rbenv -v rbenv 0.4.0 and rails -v Rails 4.2.4

How can I fix this so I can create a new rails app without this issue?

3 Answers3

0

Run

bundle install --path=vendor/bundle

That will install the Gems inside the vendor/bundle directory of your project vs the system gems directory. This is a nice way to keep your gems isolated between apps vs polluting your system gems. Just my 2 cents.

Tom Fast
  • 1,138
  • 9
  • 15
0

Make sure your user belongs to the RVM group

sudo usermod -a -G rvm myUserName

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

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

Open a new shell and run the gem install rubygems-update.

 Everything should run fine now without sudo.
vishal
  • 2,258
  • 1
  • 18
  • 27
0

Running:

rails new test

will not work for an application name anyway because it is a reserved rails word. You would want to go with something like testapp

nikkypx
  • 1,925
  • 17
  • 12