Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSX Ruby Gems Add to ruby path?

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

like image 493
wuntee Avatar asked Jan 28 '26 06:01

wuntee


1 Answers

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

like image 171
hellvinz Avatar answered Jan 30 '26 01:01

hellvinz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!