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?
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
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.
精彩评论