# RMagick as a local gem on Dreamhost

**URL:** <https://www.ruby-forum.com/t/rmagick-as-a-local-gem-on-dreamhost/71620>\
**Category:** Rails\
**Created:** [October 10, 2006, 10:32am UTC](https://www.ruby-forum.com/t/rmagick-as-a-local-gem-on-dreamhost/71620 "2006-10-10T10:32:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iktorn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b487fb/32.png) [@iktorn](https://www.ruby-forum.com/u/iktorn)\
**Post date:** [October 10, 2006, 10:32am UTC](https://www.ruby-forum.com/t/rmagick-as-a-local-gem-on-dreamhost/71620/1 "2006-10-10T10:32:49Z")

</div>

As DH refused to install new version of RMagick gem “globally” I had  
to install it locally. Here my install details:

Local gems installed in:  
/home/user/.gems  
/home/user/.gems/gems/rmagick-1.14.0

Local libs installed in:  
/home/user/lib

My app located in:  
/home/user/apps/tptest/current

On top of my config/enviroment.rb:  
ENV[‘GEM\_PATH’] = ‘/home/user/.gems:/usr/lib/ruby/gems/1.8’  
ENV[‘GEM\_HOME’] = ‘/home/user/.gems’

My .bashrc and .bash\_profile:

# ~/.bash\_profile: executed by bash(1) for login shells.

umask 002  
PS1='[\h]$ ’

export PATH=/home/user/bin:$PATH  
export GEM\_PATH=/home/user/.gems:/usr/lib/ruby/gems/1.8  
export GEM\_HOME=/home/user/.gems

export LD\_LIBRARY\_PATH=/home/user/lib

# ~/.bashrc: executed by bash(1) for non-login shells.

export PATH=/home/user/bin:$PATH  
export GEM\_PATH=/home/user/.gems:/usr/lib/ruby/gems/1.8  
export GEM\_HOME=/home/user/.gems

export LD\_LIBRARY\_PATH=/home/user/lib

* * *

When I run my scripts from console the local version gets loaded:

[jurupa]$ ruby script/console

> > require\_gem ‘rmagick’  
> > =\> true  
> > require ‘RMagick’  
> > =\> true  
> > Magick::Long\_version  
> > =\> “This is RMagick 1.14.0 ($Date: 2006/09/27 21:26:35 $) Copyright  
> > (C) 2006 by Timothy P. Hunter\nBuilt with ImageMagick 6.2.9 10/03/06  
> > Q16 [http://www.imagemagick.org](http://www.imagemagick.org)\nBuilt for ruby 1.8.2 (2005-04-11)  
> > [i386-linux]\nWeb page: [http://rmagick.rubyforge.org](http://rmagick.rubyforge.org)\nEmail:  
> > removed\_email\_address@domain.invalid\n”

* * *

When I run it “live” from web I get the following exception:  
RMagick.rb:28: uninitialized constant Magick::Enum (NameError)

Browsing the web reveals that it should be a problem of:  
LD\_LIBRARY\_PATH

That is why I use:  
export LD\_LIBRARY\_PATH=/home/user/lib  
in .bashrc

AND

PassEnv LD\_LIBRARY\_PATH  
in .htaccess

Still no luck. Are there any other issues I’m missing? It seems like  
FastCGI is not “using” the correct LD\_LIBRARY\_PATH… HELP!

---

<div class="post-metadata">

**Author:** ![iktorn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b487fb/32.png) [@iktorn](https://www.ruby-forum.com/u/iktorn)\
**Post date:** [December 4, 2006, 3:25am UTC](https://www.ruby-forum.com/t/rmagick-as-a-local-gem-on-dreamhost/71620/2 "2006-12-04T03:25:05Z")

</div>

Hi Wiktor,

A late reply I know, but I have come across the exact same problem with  
my hosting company as well. I also installed ImageMagick locally and  
RMagick as a local gem. I can get RMagick loaded without problem in my  
./script/console but it will not load via Apache/FastCGI.

I got the same message you got once while playing around with several  
things (think it may have been when I was playing around with  
“require\_gem ‘RMagick’”). But I took it down to a simple “require  
‘RMagick’” in my environment.rb and get:

libMagick.so.10: cannot open shared object file: No such file  
or directory - /home/myusername/gems/gems/rmagick-1.14.1/lib/RMagick.so

I also echoed out LD\_LIBRARY\_PATH after the load failure and it was set  
to the correct path, so I think you are on the right track with the  
theory that FastCGI is getting a different value for LD\_LIBRARY\_PATH for  
some bizaar reason.

I hope someone who has seen (and hopefully solved) this problem will  
spot this thread and give us a hand because I have been going around in  
circles on this issue for almost a week. My hosting company said they  
would install RMagick system wide but it has been quiet on that front  
for several days now so I am not sure if they will. Anyway I would like  
to see the solution to this because there will not doubt be a call to  
load up another gem at a later date that uses an external .so library.

Cheers, and let me know if you make any new discoveries - I will be sure  
to post here if I do.

Chad.

---

<div class="post-metadata">

**Author:** ![iktorn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b487fb/32.png) [@iktorn](https://www.ruby-forum.com/u/iktorn)\
**Post date:** [September 25, 2007, 11:02pm UTC](https://www.ruby-forum.com/t/rmagick-as-a-local-gem-on-dreamhost/71620/3 "2007-09-25T23:02:30Z")

</div>

Just wanting to bump this thread.

I’m facing the same issue.
