我正在使用MacPorts来管理我的Ruby / Rails / Gems安装。在执行gem install wirble
之后,当我启动irb实例时,wirble无法加载。这是输出:
$ irb --simple-prompt
Couldn't load Wirble: no such file to load -- wirble
Wirble gem没有出现在我的$ LOAD_PATH:
中>> puts $:
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionmailer-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activeresource-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql-2.8.1/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql-2.8.1/ext
/opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql-2.8.1/bin
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rack-1.0.1/bin
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rack-1.0.1/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rails-2.3.5/bin
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rails-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/bin
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rubygems-update-1.3.7/hide_lib_for_update
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rubygems-update-1.3.7/bin
/opt/local/lib/ruby1.9/site_ruby/1.9.1
/opt/local/lib/ruby1.9/site_ruby/1.9.1/i386-darwin10
/opt/local/lib/ruby1.9/site_ruby
/opt/local/lib/ruby1.9/vendor_ruby/1.9.1
/opt/local/lib/ruby1.9/vendor_ruby/1.9.1/i386-darwin10
/opt/local/lib/ruby1.9/vendor_ruby
/opt/local/lib/ruby1.9/1.9.1
/opt/local/lib/ruby1.9/1.9.1/i386-darwin10
.
=> nil
>>
明确安装了宝石:
$ gem list |grep -i wirble
wirble (0.1.3)
它位于/opt/local/lib/ruby/gems/1.9.1/gems/wirble-0.1.3/
如何将我安装的这个和未来的宝石附加到我的$ LOAD_PATH?
答案 0 :(得分:3)
你在irb中需要RubyGems吗?
require 'rubygems'
在要求任何宝石之前,可能需要。您也可以将此行放在~/.irbrc
中,这样在启动irb时将自动需要RubyGems。
我不确定为什么你的某些宝石在你的载入路径中 - 宝石通常不会出现在$:
中。
答案 1 :(得分:1)