# How to add external modules' dir?

**URL:** <https://www.ruby-forum.com/t/how-to-add-external-modules-dir/111622>\
**Category:** Ruby\
**Created:** [August 9, 2007, 8:23am UTC](https://www.ruby-forum.com/t/how-to-add-external-modules-dir/111622 "2007-08-09T08:23:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lee\_NL](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/46a35a/32.png) [@Lee\_NL](https://www.ruby-forum.com/u/Lee_NL)\
**Post date:** [August 9, 2007, 8:23am UTC](https://www.ruby-forum.com/t/how-to-add-external-modules-dir/111622/1 "2007-08-09T08:23:10Z")

</div>

In Perl, there is default module directory, say C:\perl\lib;  
C:\perl\site\lib,  
and I can add more default module directory by editing the registry :  
HKEY\_LOCAL\_MACHINE\SOFTWARE\PERL with  
given string value Lib =\> “C:\OtherPM\_Dir;C:\AnotherPM\_Dir”

Is that similar way to do this in Ruby ? Any hints would highly  
appreciate!

Best regards,  
Lee

---

<div class="post-metadata">

**Author:** ![Lee\_NL](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/46a35a/32.png) [@Lee\_NL](https://www.ruby-forum.com/u/Lee_NL)\
**Post date:** [August 9, 2007, 9:36am UTC](https://www.ruby-forum.com/t/how-to-add-external-modules-dir/111622/2 "2007-08-09T09:36:20Z")

</div>

Hi,

I know 3 ways to do it :

- Setting the env variable RUBYLIB
- Adding -I with the path to the command line “ruby …”
- Updating the “$:” array variable within your program (try “ruby -e  
‘puts $:’”)

Hope this help,  
Come
