# Library path in order to use gems

**URL:** <https://www.ruby-forum.com/t/library-path-in-order-to-use-gems/191316>\
**Category:** IronRuby\
**Created:** [July 9, 2010, 2:47pm UTC](https://www.ruby-forum.com/t/library-path-in-order-to-use-gems/191316 "2010-07-09T14:47:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![acampos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@acampos](https://www.ruby-forum.com/u/acampos)\
**Post date:** [July 9, 2010, 2:47pm UTC](https://www.ruby-forum.com/t/library-path-in-order-to-use-gems/191316/1 "2010-07-09T14:47:00Z")

</div>

Hi,

I’d like my C# hosted IronRuby script to be able to use gems (I install  
them with igem so they go into the IronRuby directory). I’ve been able  
to successfully require an installed gem but to do so I had to  
explicitly add the path it was installed in to the app.config  
LibraryPaths setting. If I have to do that for every gem it’s going to  
end up being a very long parameter.

Is there a library path I can specify so that IronRuby will search  
beneath it to when doing requires?

My code looks like:

var setup = ScriptRuntimeSetup.ReadConfiguration();  
var scriptRuntime = Ruby.CreateRuntime(setup);  
ScriptEngine scriptEngine = Ruby.GetEngine(scriptRuntime);

string script =  
“require ‘httpclient’\n” +  
“print ‘hello\n’”;

scriptEngine.Execute(script);

The require works with a LibraryPath setting of:

```
    <set language='Ruby' option='LibraryPaths'

```

value=‘C:\Data\Dev\IronRuby\ironruby-1.0v4\lib\ironruby;C:\Data\Dev\IronRuby\ironruby-1.0v4\lib\ruby\1.8;C:\Data\Dev\IronRuby\ironruby-1.0v4\lib\ironruby\gems\1.8\gems\httpclient-2.1.5.2\lib;’/\>

I would have thought instead of  
C:\Data\Dev\IronRuby\ironruby-1.0v4\lib\ironruby\gems\1.8\gems\httpclient-2.1.5.2\lib  
I would specify  
C:\Data\Dev\IronRuby\ironruby-1.0v4\lib\ironruby\gems\1.8\gems and sub  
directories would be automatically searched?

Thanks,  
Aaron

---

<div class="post-metadata">

**Author:** ![acampos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@acampos](https://www.ruby-forum.com/u/acampos)\
**Post date:** [July 9, 2010, 7:05pm UTC](https://www.ruby-forum.com/t/library-path-in-order-to-use-gems/191316/2 "2010-07-09T19:05:34Z")

</div>

If you first require ‘rubygems’ you shouldn’t need to set any paths.

Tomas

---

<div class="post-metadata">

**Author:** ![acampos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@acampos](https://www.ruby-forum.com/u/acampos)\
**Post date:** [July 12, 2010, 12:47pm UTC](https://www.ruby-forum.com/t/library-path-in-order-to-use-gems/191316/3 "2010-07-12T12:47:43Z")

</div>

Perfect, thanks!
