Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rubygems issue when runnuing rails new

Sorry this might be a basic question but I am new to rails. I wanted to start a new rails project by the command rails new projName. In the middle of the process I got this message:

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.

Password:

I wasn't so sure whether I should give my password but I searched and I found that it is safe to do that (or at least that what I understood).

At the end I got this warning:

Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
* bin/rake: spring inserted
* bin/rails: spring inserted

so I tried to run gem install Rubygems and I got:

ERROR:  Could not find a valid gem 'Rubygems' (>= 0) in any repository
ERROR:  Possible alternatives: ruby_gem, ruby_gem_eg, ruby-rets, ruby-gen, rubyless

I tried gem install rubygems-update and I got:

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

I have already installed rails through RVM, and I am not sure why I am having those permission issues. As I am not experienced with gems I am stuck and don't know how to fix these issues.

like image 570
Salah Saleh Avatar asked Dec 02 '22 17:12

Salah Saleh


1 Answers

It should be sufficient to run a:

gem update --system

to upgrade Rubygem to the latest version.

like image 56
Andrea Salicetti Avatar answered Dec 14 '22 22:12

Andrea Salicetti