# A newbie question about path

**URL:** <https://rubytalk.org/t/a-newbie-question-about-path/11868>\
**Category:** ruby-talk\
**Created:** [2 June 2004 01:18 UTC](https://rubytalk.org/t/a-newbie-question-about-path/11868 "2004-06-02T01:18:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam\_Sungshik\_Kong](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@Sam\_Sungshik\_Kong](https://rubytalk.org/u/Sam_Sungshik_Kong)\
**Post date:** [2 June 2004 01:18 UTC](https://rubytalk.org/t/a-newbie-question-about-path/11868/1 "2004-06-02T01:18:39Z")

</div>

Hello!

I’ve got a simple question.

I want to have my own libraries in a directory.  
Let’s say that it’s “C:\mylib”.  
And there’s a file names “a.rb”.

I want to write like  
require “a”

What should I do to make ruby interpreter know where to find the file all  
the time.

ENV[“RUBYLIB”] is valid only for the session, right?

Thanks.

Sam

---

<div class="post-metadata">

**Author:** ![daz](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@daz](https://rubytalk.org/u/daz)\
**Post date:** [2 June 2004 01:58 UTC](https://rubytalk.org/t/a-newbie-question-about-path/11868/2 "2004-06-02T01:58:37Z")

</div>

Sam Sungshik Kong wrote:

> Hello!
> 
> I’ve got a simple question.
> 
> I want to have my own libraries in a directory.  
> Let’s say that it’s "C:\mylib".  
> And there’s a file names “a.rb”.
> 
> I want to write like  
> require “a”
> 
> What should I do to make ruby interpreter know where to find the file all  
> the time.
> 
> ENV[“RUBYLIB”] is valid only for the session, right?

Consider putting your own libraries in:

RUBY/lib/ruby/site\_ruby/1.x (if version specific)  
RUBY/lib/ruby/site\_ruby (general utilities)

They’re not just for other people’s packages.

> **···**
>
> * * *
> 
> If your library is in the “current directory”, Ruby would find it there, too.
> 
> * * *
> 
> There’s the -I’C:/mylib’ command line option.
> 
> * * *
> 
> Or $LOAD\_PATH \<\< ‘C:/mylib’ before “require”.
> 
> * * *
> 
> Someone may even answer the question you asked 🙂
> 
> daz

---

<div class="post-metadata">

**Author:** ![Tim\_Hunter3](https://avatars.discourse-cdn.com/v4/letter/t/4491bb/32.png) [@Tim\_Hunter3](https://rubytalk.org/u/Tim_Hunter3)\
**Post date:** [2 June 2004 13:08 UTC](https://rubytalk.org/t/a-newbie-question-about-path/11868/3 "2004-06-02T13:08:44Z")

</div>

Add RUBYLIB to the list env. variables defined during startup. If  
you’re using Win95/98, add

SET RUBYLIB=C:\mylib

to your autoexec.bat. If you’re using WinXP, use Control  
Panel-\>System-\>Advanced-\>Environment Variables to add RUBYLIB to the  
list of user variables.

> **···**
>
> On Wed, 02 Jun 2004 01:16:40 GMT, “Sam Sungshik Kong” [ssk@chol.nospam.net](mailto:ssk@chol.nospam.net) wrote:
> 
> > ENV[“RUBYLIB”] is valid only for the session, right?
