DonPaulie
DonPaulie

Reputation: 2214

Ruby 1.8.7 upgrade to ruby 1.9.2

I am going through this tutorial, but I already had Ruby 1.8.7 installed. I need to have 1.9.2/1.9.3 version.

I started to use RVM.

$ rvm list rubies
rvm rubies
    ruby-1.8.7-p358 [ x86_64 ]
    ruby-1.9.2-p318 [ x86_64 ]
=*  ruby-1.9.2-p320 [ x86_64 ]
    ruby-1.9.3-p194 [ x86_64 ]

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

but if I run ruby -v it returns still 1.8.7.

$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

other return values:

$ whereis ruby
ruby: /usr/bin/ruby /usr/bin/ruby1.8 /usr/lib/ruby /usr/share/man/man1/ruby.1.gz
$ which rails
/usr/local/bin/rails
$ which ruby
/usr/bin/ruby

Upvotes: 2

Views: 2061

Answers (2)

Pritesh Jain
Pritesh Jain

Reputation: 9146

Try

$ rvm use ruby-1.9.2-p320

then

$ ruby -v

what does this return?

This should change your ruby version to ruby-1.9.2-p320 in the current console and if you want it on every new opened terminal you may use --default option

try

$ rvm --default use ruby-1.9.2-p320

then

$ruby -v

should return ruby-1.9.2-p320 version in the current and in every new window terminal opened. Any time you want to return to your system ruby installation use

$ rvm use system

Upvotes: 0

Kevin Bedell
Kevin Bedell

Reputation: 13404

When you're typing ruby you're still hitting the system ruby, not the rvm ruby.

Did you follow all the directions here: https://rvm.io//rvm/install/ ?

It looks like you're running Linux -- did you see this section in the rvm install docs?

If you open a new shell and running:

$ type rvm | head -1
does not show "rvm is a function", RVM isn't being sourced correctly.

Ensure that RVM is sourced after any path settings as RVM and manipulates the path. If you don't do this, RVM may not work as expected.

If you are using GNOME on Red Hat, CentOS or Fedora, ensure that the Run command as login shell option is checked under the Title and Command tab in Profile Preferences. After changing this setting, you may need to exit your console session and start a new one before the changes take affect.

Also, rvm adds some lines to your .bashrc file to load itself into memory whenever you open a console session. It looks like this may be your issue.

In my .bashrc, for example, rvm inserted the following:

export PATH=/opt/local/bin:/opt/local/sbin:/opt/local/lib/postgresql84/bin:$PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

Is there something similar in yours? Also, if you're using z-shell you may need to take some extra steps that are outlined in the install docs.

Upvotes: 1

Related Questions