Sriram Kumar
Sriram Kumar

Reputation: 68

DIfferent versions of ruby in ubuntu

I recently started following M Hartls tutorials on how to build a simple app using RoR. I nearly wasted one full day on installing RVM and the ruby, since the default RVM on ubuntu is buggy. Once I install ruby through RVM

curl -L https://get.rvm.io | bash -s stable --ruby

it says it installed ruby 2.x version.

but when I type

ruby -v

It says the ruby version is 1.8.x. Why is that?

Upvotes: 0

Views: 493

Answers (3)

zwippie
zwippie

Reputation: 15515

I think you missed the message given after installing RVM. It's something like:

Please make sure the following line is somewhere in your .bashrc:

source /home/<username>/.rvm/scripts/rvm

What is the output of ruby -v after you executed that line in the console?

Upvotes: 1

Abdul Baig
Abdul Baig

Reputation: 3721

If you are using RVM then: do

rvm list

this will show list of installed rubies

and the do

rvm use XXXXXXX

XXXXX means the version you want to use from the list.

This will use the specified ruby. but after opening new terminal it might be again changed automatically. To avoid this use :

rvm use XXXXXX --default

For example of mine system:

rvm list

rvm rubies

ruby-1.9.3-p545 [ x86_64 ]

=* ruby-2.0.0-p451 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

$ rvm use 2.0.0

Using .rvm/gems/ruby-2.0.0-p451

$ rvm use 2.0.0 --default

Using .rvm/gems/ruby-2.0.0-p451

Upvotes: 0

Brett
Brett

Reputation: 11

Your default ruby version is set to 1.8.x.

Type "rvm list" to list installed ruby versions "*" will appear next to your default.

Type "rvm use x.x.x" to use a different version of ruby.

To set a different default version of ruby type "rvm --default use x.x.x".

Upvotes: 1

Related Questions