user1972031
user1972031

Reputation: 557

How to make bash pointing to correct version of ruby

I have 2 version of Ruby on the system, but like to use version 1.8.6. Could someone show me how to do this?


/usr/local/bin/ruby -v

ruby 1.8.6 (2009-08-04 patchlevel 383) [x86_64-linux]

/usr/local/rvm/rubies/ruby-2.1.2/bin/ruby -v

ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]

which ruby

/usr/local/rvm/rubies/ruby-2.1.2/bin/ruby

Thanks,

PL

Solution:

I found solution at https://superuser.com/questions/137130/how-to-configure-installed-ruby-and-gems by adding 2 lines in ~/.gemrc file. Thanks for all replies.

Upvotes: 0

Views: 559

Answers (3)

Addison
Addison

Reputation: 3949

You can switch your version of ruby using rvm, assuming you installed that version with rvm, like this:

rvm use 1.8.6 --default

Or if you had ruby pre-installed and want to use that version than use this:

rvm use system --default

Of course, remove the --default if you don't want it to be the default.

Seeing that you didn't install 1.8.6 with rvm, I would reinstall it with rvm, so you are using rvm consistently across all your ruby versions.

Upvotes: 0

jcm
jcm

Reputation: 1789

Set it in a .ruby-version file in your project directory. Something like:

1.8.6-p383

Upvotes: 0

jcaron
jcaron

Reputation: 17710

You're not on the right forum, but the answer lies in the order of directories in your $PATH. Check your .profile and/or /etc/profile.

Upvotes: -1

Related Questions