Alex Lopez Alex Lopez - 1 year ago 131
Ruby Question

rails isnt seeing proper dir of ruby

I'm not sure whats wrong but take a look at the picture it says everything i know about the problem

enter image description here

$ gem install rails
Fetching: activesupport- (100%) ERROR:
Error installing rails: activesupport requires Ruby version >= 2.2.2

Answer Source

The issue is the ruby version available when rails installation starts is still 2.2.1. Even if you upgrade the ruby version, just check the ruby version

  $ ruby -v

It should still show older one.

You should be using ruby version manager(rvm) to manage different versions of ruby. Using this you can change the default version of ruby so that latest version of rails can be installed properly. In case you want to install some other rails version say 4.2 which is compatible with version of ruby available as default in your system,

      $ gem install rails -v=4.2

This should install the rails successfully.

Now for better management and as a good practise, Install rvm,

  $ \curl -sSL | bash -s stable

Now install the version of ruby as required using

 $ rvm install 2.3.1

Next it make this version as default

 $ rvm use 2.3.1 --default

just in case you need this version only for a specific project, just use

$ rvm use 2.3.1

Now check

     $ ruby -v

Fire the rails gem installation now to install.

     $ gem install rails

This should help

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download