How do I associate a new rvm install with existing

2019-01-28 03:44发布

问题:

I was having a problem with RVM, so I uninstalled and re-installed it.

The truth is I actually tried rbenv, but that didn't work out for me so I am trying to get rvm up and running again - without having to install duplicate versions of Ruby.

I have at least 1 existing version of Ruby installed:

ruby --version
ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0]

But when I do rvm list I get a blank list:

bash-3.2$ rvm list

rvm rubies


# Default ruby not set. Try 'rvm alias create default <ruby>'.

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

So my question has two parts:

  • How do I see all the versions of Ruby on my system (given that rvm is not showing me any)?
  • How do I associate the new RVM install with the existing versions of Ruby?

Or am I better off removing all existing versions of Ruby and re-installing everything? That seems like a pain in the ass though.

回答1:

You can add an existing ruby to rvm using:

rvm mount /path/to/ruby 

or:

rvm automount

but be careful as ruby installed in system might have hardcoded paths for gems - so gemsets would not work with it.

There is also new way of adding binary rubies (already compiled), for list of available builds for your platform run:

rvm list remote

and you can install those rubies using:

rvm mount -r 1.9.3

This might be default way of installing ruby to avoid compilation in next stable release of RVM - but it will work only for ruby 1.9.3+.



回答2:

You don't want to associate RVM with an existing Ruby, you just want to install a new Ruby.

You don't want to remove the system Ruby, either; OS X depends on it.

Install a new 1.8.7 under rvm, this way you can associate your own gemsets with it. Let OS X manage the default system Ruby, you just ignore it and use your own, managed solely by rvm.

(If you decide to go the rvm route.)



标签: ruby rvm