简体   繁体   中英

Using RVM with Ruby already installed

I am working on a Rails 3 project. At the client site, the network is very restricted. The network domain will not allow access to rubygems, github, etc. I have to install most thing manually. So that is how I installed the different Ruby versions. I have RVM installed now but it can not find the Rubies that are installed. RVM tells me to install the Ruby I am trying to set. Is there a way to still use RVM even though I can not use the default Ruby install as "rvm install ruby-xxx"?

It is possible to get RVM to manage multiple Ruby versions but you have to give it some help, and it can't do it with Rubies it didn't compile and install.

Any Rubies RVM didn't install are considered "system", even though there might be multiple ones. Using rvm system tells RVM to remove its path information from the front of your PATH environment variable, letting the shell do its normal search, which hopefully lands on a ruby binary. If you have multiple Rubies outside of RVM's control, you'll have to manually adjust your path. That's the cost of doing it outside of RVM.

If you want to have RVM install and manage Rubies you can manually copy the Ruby distribution source tarball files into ~/.rvm/archives . Here's the file's you'll need for the current 1.8.7 and 1.9.2:

ruby-1.8.7-p330.tar.bz2
ruby-1.9.2-p136.tar.bz2
rubygems-1.3.7.tgz

Once they're installed in that folder you should be able to tell RVM to rvm install 1.9.2-p136 or rvm install 1.8.7-p330 and it will extract the contents to ~/.rvm/src and begin the configure, compile, install steps. If it whines at all it will probably want you to unarchive those files into ~/.rvm/src first. Then try the install commands again. Basically we're playing with RVM's mind at this point, so if you run into problems you should probably ask the developer for help. You can get his email via rvm -v .

That's what I have to do with one of my hosts and it works.

There are two ways:

  1. disable rvm:

    • rvm system - disable rvm ruby
    • rvm alias delete default - disable default ruby

    this should do the trick, but it will disable default rvm ruby, http://rvm.io/rvm/basics/

  2. mount existing ruby:

    • rvm mount /path/to/ruby/bin/ruby OR:
    • rvm automount

    will add existing rubies to rvm, https://github.com/wayneeseguin/rvm/blob/master/help/mount

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM