tags:

views:

31

answers:

1

I am just starting to learn ruby. It seems that the default gems install path is not part of Ruby. Is this normal behavior? How can I set the default ruby path? Example:

[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

As you can see packetfu is installed in /Library/Ruby/Gems/1.8/gems/, but ruby cant find it...

+1  A: 

that's because you're not in the directory where packetfu.rb file lies and there's no require 'rubygems' to add the gems paths in your script

hellvinz
what do you mean by "and there's no require 'rubygems' to add the gems paths in your script" - again, new to ruby (1 hour into it)
wuntee
oups sorry i've been a little quick :) In order to have the gems working a script must include require 'rubygems'. This will add the gems path to your ruby load path. otherwise you just have standard ruby load path
hellvinz