Question

I have just installed rvm today and it looks really handy/powerful.

I think I am getting the hang of it, but...

When using an rvm installed ruby, and running irb, when I require an installed gem, something, like 'rvm', I get:

> kimptoc$ rvm use 1.8.7
Using /Users/kimptoc/.rvm/gems/ruby-1.8.7-p302


> kimptoc$ gem list

*** LOCAL GEMS ***

abstract (1.0.0)
...
rvm (1.0.11)
...


> kimptoc$ irb
ruby-1.8.7-p302 > require 'rvm'
LoadError: no such file to load -- rvm
    from (irb):1:in `require'
    from (irb):1

But when using the "system" ruby, it works fine.

Historically I have been using sudo gem install ... and so the "system" gems are generally installed that way. Could that be my problem? Do I need to uninstall these to fix things?

I am running OSX 10.6.4. "system" is the default OSX ruby, 1.8.7 (p174)

Thanks in advance for any tips/thoughts, Chris

Was it helpful?

Solution

Try require 'rubygems' first.

OTHER TIPS

> rvm use 1.8.7
> rvm info
     (Find the homes -> gem directory)
> ls -al ~/.rvm/gems/ruby-1.8.7   (Substitute your gem directory as needed)

Is your gem in this directory?

Generally speaking, using sudo gem install with rvm is a bad idea.

As of Ruby 1.9.3 you no longer need, can, require rubygems and you only need to require rvm.

If you want to use it in your .irbrc file for using wirble or awsome print you can use a simple trick to avoid a login error saying it can't include or 'rubygems' or 'rvm'

if RUBY_VERSION > "1.8.7"
  require 'rvm'
else
  require 'rubygems'
end
require 'wirble'
Wirble.init
Wirble.colorize

Including both rubygems and rvm does not seem logical because RVM replaces rubygems in some sort to handle the gems and gem repositories.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top