Tony Staunton
Tony Staunton

Reputation: 135

Trying to install Rails 6 using RVM

I have installed RVM successfully on my Mac and using it I have installed Ruby 2.6.3. I have set my current and default version of Ruby to be 2.6.3. Everything seems to be fine because when I enter ruby -v into the terminal it tells me I'm using ruby 2.6.3.

My problem comes when I try to install Rails 6, I'm entering:

gem install rails --version=6.0.0 -no-ri -no-rdoc

It seems to install correctly however when I try to confirm with:

rails -v

I get:

Rails 6 requires Ruby 2.5.0 or newer.

You're running
  ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-       darwin18]

Please upgrade to Ruby 2.5.0 or newer to continue.

Why am I getting this message when my ruby -v command is telling me that I am using ruby 2.6.3

Any help would be very welcome.

Upvotes: 1

Views: 2320

Answers (2)

Shaurabh14
Shaurabh14

Reputation: 1

i also had the similar problem which i resolved by uninstalling rvm completely and then installing rbenv.

Upvotes: 0

Dbz
Dbz

Reputation: 2761

You're running ruby 2.3.7p456. You need to set your local ruby version to 2.6.3.

Try which ruby to see which ruby version is loaded.

rvm install 2.6.3
rvm use 2.6.3

You can then see which ruby is running with which ruby.

See the basics on the rvm docs

As an aside, I also recommend recommend rbenv over rvm; however, you can only have one installed. If you have both installed, you're going to have a bad time.

To make sure you do not have both installed try which rbenv, and that should return rbenv not found

Please edit your original question with the output of the following commands:

  1. which -a ruby
  2. echo $PATH (That will help debug if your $PATH is set up incorrectly.)
  3. which rbenv
  4. ls (in your project directory)

Upvotes: 1

Related Questions