views:

67

answers:

3

I am having problems with conflicting versions of Ruby that I have installed. I had 1.8.6 and then installed 1.8.7 and it has caused problems. I get the following error when trying to run my ruby on rails app:

/usr/local/lib/ruby/1.8/i686-linux/rbconfig.rb:7: ruby lib version (1.8.6) doesn't match executable version (1.8.7) (RuntimeError)

I would like to remove 1.8.7 somehow and just use 1.8.6 but have no idea how to go about doing this.

A: 

Just change your $PATH to point to the version you want.

I install ruby from the tarball (and not from the distribuition package). This way I can have several different versions working at the same time, I have just to update the $PATH in the session that I want to use a different version.

Jonas Fagundes
Thanks for the lead. I'm somewhat new to all this, where do I set the $PATH?
DavidP6
A: 

Your easiest path and future proof too would be using rvm. Download the version of ruby you want with rvm and make it the default.

Installation: http://rvm.beginrescueend.com/rvm/install/

Making it default:
rvm 1.8.6 --default

The whole process would take not more than 15 minutes. Everything is clearly explained in this. Your environment will be set before you finish watching this podcast:
http://railscasts.com/episodes/200-rails-3-beta-and-rvm

Kalyan M
A: 

Yes, setting the path:

export PATH=yourrubypath/bin:$PATH

should do it.

I recommend you install rvm, that way you can run different ruby versions and manage gem sets in a very easy way

The installation instructions are here. However it basically reduces to:

bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

Then you can install a newer ruby from source (it will compile it!):

$ rvm install 1.9.1 ; rvm 1.9.1

$ ruby -v

ruby 1.9.1p243 (2009-07-16 revision 24175) [x86_64-linux]

$ which ruby

/home/you/.rvm/ruby-1.9.1-p243/bin/ruby

You can go back to the "system" one doing:

$ rvm system
duncan
Thanks a lot. I'm not even sure what my ruby path is. This is the output of whereis ruby: /usr/bin/ruby1.8 /usr/bin/ruby /usr/lib/ruby /usr/local/bin/ruby /usr/local/lib/ruby /usr/share/man/man1/ruby.1.gz
DavidP6