1

After installation of multiple rubies by ruby-install, how to use a specific installation of ruby? Should a ruby be accessed by absolute path, or depends on some environment path like rvm?

ohho
  • 50,879
  • 75
  • 256
  • 383

2 Answers2

1

You can use postmodern's chruby to change the current Ruby:

chruby 1.9
chruby
 * ruby-1.9.3-p429
   ruby-2.0.0-p195

It also supports auto-switching based on a .ruby-version file.

Stefan
  • 109,145
  • 14
  • 143
  • 218
0

Have you considered using rbenv which wraps around that to provide an rvm-like interface?

Using those directly is not something I'd consider practical.

tadman
  • 208,517
  • 23
  • 234
  • 262
  • Since ruby-install installs rubies into /opt/rubies (root) and ~/.rubies (users) by default, rbenv will not auto-detect rubies previously installed with ruby-install. A better solution is to either use chruby (supports auto-detected /opt/rubies/ and ~/.rubies/) or RVM (recently added support for detect rubies installed into /opt/rubies). – postmodern Feb 23 '14 at 01:54
  • I wouldn't trust anything that's already been installed. It's better to scrub and rebuild if your Ruby version manager has fallen out of sync. – tadman Feb 24 '14 at 15:19