# How modify $: permanently?

**URL:** <https://www.ruby-forum.com/t/how-modify-permanently/118503>\
**Category:** Ruby\
**Created:** [October 27, 2007, 11:12pm UTC](https://www.ruby-forum.com/t/how-modify-permanently/118503 "2007-10-27T23:12:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [October 27, 2007, 11:12pm UTC](https://www.ruby-forum.com/t/how-modify-permanently/118503/1 "2007-10-27T23:12:14Z")

</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?

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [October 27, 2007, 11:30pm UTC](https://www.ruby-forum.com/t/how-modify-permanently/118503/2 "2007-10-27T23:30:00Z")

</div>

Greg W. 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  
Ruby?s library load path ($:). Directories from this  
environment variable are searched before the standard  
load path is searched.

```
             e.g.:
                   RUBYLIB="$HOME/lib/ruby:$HOME/lib/rubyext"
```

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [October 28, 2007, 12:37am UTC](https://www.ruby-forum.com/t/how-modify-permanently/118503/3 "2007-10-28T00:37:16Z")

</div>

Joel VanderWerf wrote:

> Greg W. 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  
> Ruby?s library load path ($:). Directories from this  
> environment variable are searched before the standard  
> load path is searched.
> 
> ```
> e.g.:
> 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
