# Changing the environment for current process

**URL:** <https://www.ruby-forum.com/t/changing-the-environment-for-current-process/139867>\
**Category:** Ruby\
**Created:** [June 8, 2008, 1:55pm UTC](https://www.ruby-forum.com/t/changing-the-environment-for-current-process/139867 "2008-06-08T13:55:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tammo\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ea5d25/32.png) [@Tammo\_T](https://www.ruby-forum.com/u/Tammo_T)\
**Post date:** [June 8, 2008, 1:55pm UTC](https://www.ruby-forum.com/t/changing-the-environment-for-current-process/139867/1 "2008-06-08T13:55:44Z")

</div>

I have the following situation:  
I require an additional library, not part of the current search path.  
I have done that simply by:  
$:.push()  
and that would work fine if I would not need shared libs. I tried  
to simply set  
ENV[‘LD\_LIBRARY\_PATH’] = ENV[‘LD\_LIBRAY\_PATH’]+’:’+  
but that seems not to work, the shared library is not found.  
It only works when I make an  
setenv LD\_LIBRARY\_PATH $LD\_LIBRARY\_PATH:  
before I start the script. Is there a way to modify the  
environment for the current ruby process?  
I would like to have the possibilites usually enabled by  
module ( a tool where the environment can be altered with , where no  
ruby  
support seems to exist).

Regards,  
Tammo

---

<div class="post-metadata">

**Author:** ![Tammo\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ea5d25/32.png) [@Tammo\_T](https://www.ruby-forum.com/u/Tammo_T)\
**Post date:** [June 9, 2008, 5:09pm UTC](https://www.ruby-forum.com/t/changing-the-environment-for-current-process/139867/2 "2008-06-09T17:09:36Z")

</div>

When I have wanted to make sure that the lib subdir of the directory  
from  
which the program executes is added to the load path, I use this:

# 

# make sure we can pull in anything under the directory where the

program is

# being executed

# 

$LOAD\_PATH \<\< File::join(File::dirname($0), “lib”)

seems to work for me.
