tags:

views:

186

answers:

2

I have rvm installed on a Mac OS X 10.6 system with the system ruby and 1.9.1. I also have this basic ruby script:

#!/usr/bin/ruby

require 'curb-fu'

I need the script to use the system ruby regardless of what rvm's using at any given time; I'm assuming that I've got that right, at least.

I've switched to the system ruby (rvm use system) and then installed the gem (gem install curb-fu). If I run irb and type require 'curb-fu', it works. However, running that script with ./myscript.rb fails:

/Users/me/bin/podcast_notify.rb:6:in `require': no such file to load -- curb-fu (LoadError)
from /Users/me/bin/podcast_notify.rb:6

What's going wrong here? How do I install curb-fu so that it's always available to this script?

+1  A: 

Try this:

#!/usr/bin/ruby -rubygems
require 'curb-fu'

Also, maybe you should use sudo gem install if you're back in system ruby land.

Konstantin Haase
Thanks - I can't believe I forgot to require rubygems *again*…Even with `sudo gem install`, though, it only works when the system ruby has been selected with rvm: I get `dyld: Symbol not found: _rb_str_new_cstr` otherwise...
John Yeates
If you have further questions about RVM, there are people willing to help 24/7 in the #rvm channel on freenode: http://webchat.freenode.net/?channels=rvm.
Konstantin Haase
+1  A: 

You need to require rubygems explicitely As Konstantin said.

#!/usr/bin/ruby 

require "rubygems"
require "curb-fu"

Also, better to ask such questions in #rvm on irc.freenode.net

Wayne E. Seguin