OSX Ruby Gems添加到ruby路径?

时间:2010-10-06 17:54:46

标签: ruby macos rubygems

我刚开始学习红宝石。似乎默认的gems安装路径不是Ruby的一部分。这是正常的行为吗?如何设置默认的ruby路径?例如:

[11:53:33]wuntee:/Library/Ruby/Gems/1.8/gems/packetfu-1.0.0/examples$ sudo ruby arphood.rb 
Fetching the oui.txt from IEEE, it'll be a second. Avoid this with arphood.rb <filename>.
arphood.rb:30:in `require': no such file to load -- packetfu (LoadError)
    from arphood.rb:30:in `arp_everyone'
    from arphood.rb:51

正如你所看到的,packetfu安装在/Library/Ruby/Gems/1.8/gems/中,但ruby无法找到它......

1 个答案:

答案 0 :(得分:4)

那是因为你不在packetfu.rb文件所在的目录中,并且不需要'rubygems'来在脚本中添加gems路径