如何将新的 rvm 安装与现有的 ruby 版本相关联? [英] How do I associate a new rvm install with existing ruby versions?
问题描述
我在使用 RVM 时遇到了问题,所以我卸载并重新安装了它.
I was having a problem with RVM, so I uninstalled and re-installed it.
事实是我实际上尝试过 rbenv,但这对我没有用,所以我试图让 rvm 重新启动并运行 - 无需安装重复版本的 Ruby.
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.
我至少安装了 1 个现有版本的 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]
但是当我执行 rvm list
时,我得到一个空白列表:
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:
- 如何查看系统上的所有 Ruby 版本(假设 rvm 没有显示任何版本)?
- 如何将新的 RVM 安装与现有的 Ruby 版本相关联?
还是我最好删除所有现有版本的 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.
推荐答案
您可以使用以下方法将现有的 ruby 添加到 rvm:
You can add an existing ruby to rvm using:
rvm mount /path/to/ruby
或:
rvm automount
但要小心,因为安装在系统中的 ruby 可能有 gems 的硬编码路径 - 所以 gemsets 无法使用它.
but be careful as ruby installed in system might have hardcoded paths for gems - so gemsets would not work with it.
还有添加二进制 rubies 的新方法(已编译),用于您的平台运行的可用构建列表:
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
这可能是安装 ruby 的默认方式,以避免在下一个稳定版本的 RVM 中进行编译 - 但它仅适用于 ruby 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+.
这篇关于如何将新的 rvm 安装与现有的 ruby 版本相关联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!