3

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...

2
  • what does the command gem environment print out? Commented Oct 6, 2010 at 18:01
  • On a side note please check out "Ruby Version Manager": rvm.beginrescueend.com It will make your Ruby experience a lot more fun and less painful! Commented Oct 7, 2010 at 1:06

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

2 Comments

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)
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.