Search code examples
rubygraph-theoryrgl

Install non-gem library in Ruby


How do you install a library that is not a gem in Ruby?

I'm trying to use graphy.

In the example usage, it says to require 'graphy', but even when my ruby file is in the same directory as graphy.rb, I get the following error:

<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- graphy.rb (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from foo.rb:1:in `<main>'

Solution

  • Tell ruby to look in the current dir using the -I flag:

    ruby -I. my_script.rb
    

    To see the ruby load path, add puts $: at the top of your script.