如何将RVM指向我的Homebrew Ruby目录?(How do I point RVM to my Homebrew Ruby dir?)

我使用自制软件安装了Ruby 1.9.2,然后安装了RVM。

我想将RVM指向我在Cellar文件夹中的版本。 如何让rvm --default 1.9.1指向Cellar中的那个而不必使用RVM重新安装它?

I installed Ruby 1.9.2 using homebrew, then installed RVM.

I want to point RVM to the version I have in my Cellar folder. How can I make rvm --default 1.9.1 point to the one in Cellar without having to reinstall it again using RVM?

最满意答案

你不能这样做并获得正确的行为。

当作为单用户的沙箱运行时,RVM在其自己的目录中工作。 它控制的任何Ruby都将存在于~/.rvm目录中。

RVM控制之外的任何内容都将被视为system设置,由您来管理是否是安装在/usr/bin或/usr/local/bin或/opt或任何地方的常规Ruby。

在我看来,你应该让RVM管理Ruby安装。 它非常灵活,并迅速成为在Linux和Mac OS上管理Ruby开发环境的首选方式。

您可以尝试从Cellar文件夹创建别名到~/.rvm的适当位置,但RVM会在安装过程中修改一些内容,例如gem ,这不会在Homebrew安装的文件夹中完成,并会导致RVM的gem支持打破Ruby版本。

You can't do it and get the right behavior.

RVM works within its own directory when running as a single-user's sandbox. Any Ruby it controls will exist in your ~/.rvm directory.

Anything outside of RVM's control will be considered the system setting, and it will be up to you to manage whether that is the regular Ruby installed in /usr/bin or /usr/local/bin or in /opt or wherever.

In my opinion, you should let RVM manage the Ruby installations. It is very slick and has rapidly become the favored way to manage Ruby development environments on Linux and Mac OS.

You could try creating aliases from the Cellar folder to the appropriate place in the ~/.rvm, but RVM modifies some things during its install process, such as gem, which would not be done in the Homebrew-installed folder, and would cause RVM's gem support to break for that Ruby version.

更多推荐