# How modify $: permanently?

**URL:** <https://rubytalk.org/t/how-modify-permanently/41718>\
**Category:** ruby-talk\
**Created:** [27 October 2007 21:12 UTC](https://rubytalk.org/t/how-modify-permanently/41718 "2007-10-27T21:12:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greg\_Willits](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@Greg\_Willits](https://rubytalk.org/u/Greg_Willits)\
**Post date:** [27 October 2007 21:12 UTC](https://rubytalk.org/t/how-modify-permanently/41718/1 "2007-10-27T21:12:16Z")

</div>

Is there a way to add a path to $: permanently so I don't have to append  
a path at the start of every script that needs it?

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Joel\_VanderWerf1](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@Joel\_VanderWerf1](https://rubytalk.org/u/Joel_VanderWerf1)\
**Post date:** [27 October 2007 21:29 UTC](https://rubytalk.org/t/how-modify-permanently/41718/2 "2007-10-27T21:29:13Z")

</div>

Greg Willits wrote:

> Is there a way to add a path to $: permanently so I don't have to append  
> a path at the start of every script that needs it?

Use the RUBYLIB environment variable. From man ruby:

RUBYLIB A colon-separated list of directories that are added to  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ruby?s library load path ($:). Directories from this  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;environment variable are searched before the standard  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;load path is searched.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.g.:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RUBYLIB="$HOME/lib/ruby:$HOME/lib/rubyext"

> **···**
>
> --  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

---

<div class="post-metadata">

**Author:** ![Greg\_Willits](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@Greg\_Willits](https://rubytalk.org/u/Greg_Willits)\
**Post date:** [27 October 2007 22:37 UTC](https://rubytalk.org/t/how-modify-permanently/41718/3 "2007-10-27T22:37:17Z")

</div>

Joel VanderWerf wrote:

> Greg Willits wrote:
> 
> > Is there a way to add a path to $: permanently so I don't have to append  
> > a path at the start of every script that needs it?
> 
> Use the RUBYLIB environment variable. From man ruby:
> 
> RUBYLIB A colon-separated list of directories that are added to  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ruby?s library load path ($:). Directories from this  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;environment variable are searched before the standard  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;load path is searched.
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.g.:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RUBYLIB="$HOME/lib/ruby:$HOME/lib/rubyext"

took me a bit to put that all together (not a nix geek), but got it now.  
Thanks.

I added this to my PROFILE

export RUBYLIB=$RUBYLIB:/usr/local/lib/ruby/..... etc for what I needed

-- gw

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
