# Problem installing gem

**URL:** <https://www.ruby-forum.com/t/problem-installing-gem/97149>\
**Category:** Ruby\
**Created:** [July 5, 2006, 8:40am UTC](https://www.ruby-forum.com/t/problem-installing-gem/97149 "2006-07-05T08:40:40Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [July 5, 2006, 8:40am UTC](https://www.ruby-forum.com/t/problem-installing-gem/97149/1 "2006-07-05T08:40:40Z")

</div>

Hi, first post here, hope it’s the right forum.

I recently tried to install RoR on two systems, both RedHat9, very  
similar configurations, although the one is a server (hence remote  
installation) the other a desktop.

On the desktop, the installation was fine, and I got to my test screen  
on port 3000 without problems.

On the server, the system has got stuck on the gem installation, and I  
would like it to get unstuck! 😉

Here is what ruby setut.rb gives:

=======================================================

> > > […snip]  
> > > install timer.rb /usr/local/lib/ruby/site\_ruby/1.8/rubygems  
> > > install user\_interaction.rb /usr/local/lib/ruby/site\_ruby/1.8/rubygems  
> > > install validator.rb /usr/local/lib/ruby/site\_ruby/1.8/rubygems  
> > > install version.rb /usr/local/lib/ruby/site\_ruby/1.8/rubygems  
> > > \<— lib/rubygems  
> > > \<— lib

As of RubyGems 0.8.0, library stubs are no longer needed.  
Searching $LOAD\_PATH for stubs to optionally delete (may take a  
while)…  
…done.  
No library stubs found.

> > > […normally, at this point it would say OK on a good installation…]

/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem_original_require': no such file to load -- zlib (LoadError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
from /usr/local/lib/ruby/site\_ruby/1.8/rubygems/package.rb:9  
from  
/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/builder.rb:7 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
from /usr/local/lib/ruby/site\_ruby/1.8/rubygems.rb:93:in  
`manage_gems' from /noncrit/downloads/ruby/rubygems-0.9.0/./post-install.rb:70:in`install\_sources’  
from  
/noncrit/downloads/ruby/rubygems-0.9.0/./post-install.rb:81:in  
`try_run_hook' from setup.rb:577:in`run\_hook’  
from setup.rb:1315:in `exec_task_traverse' from setup.rb:1168:in`exec\_install’  
from setup.rb:887:in `exec_install' from setup.rb:705:in`invoke’  
from setup.rb:674:in `invoke’  
from setup.rb:1352

=======================================================

Can anyone give any pointers?  
BTW, I also tried getting rubygem-0.9.0, but it gave exactly the same  
problem.

Seems to me it’s not finding some file it needs, but I don’t understand  
enough to see which one it is (or even IF that’s the prob)

Thanks people…

---

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [July 5, 2006, 10:31am UTC](https://www.ruby-forum.com/t/problem-installing-gem/97149/2 "2006-07-05T10:31:56Z")

</div>

On 7/5/06, Alex G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On the server, the system has got stuck on the gem installation, and I  
> \<— lib/rubygems  
> /usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
> /usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
> from setup.rb:1315:in `exec\_task\_traverse’  
> problem.
> 
> Seems to me it’s not finding some file it needs, but I don’t understand  
> enough to see which one it is (or even IF that’s the prob)
> 
> Thanks people…
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

Not sure about this but it seems that either it’s not able to find your  
zlib, or it is not even installed, try to install zlib ruby bindings  
(libzlib-ruby), and the zlib library [http://www.zlib.net/](http://www.zlib.net/) itself.

---

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [July 5, 2006, 11:21am UTC](https://www.ruby-forum.com/t/problem-installing-gem/97149/3 "2006-07-05T11:21:52Z")

</div>

Rida Al Barazi wrote:

> Not sure about this but it seems that either it’s not able to find your  
> zlib, or it is not even installed, try to install zlib ruby bindings  
> (libzlib-ruby), and the zlib library [http://www.zlib.net/](http://www.zlib.net/) itself.

Thanks Rida,

That’s one of the first things that came to mind, so I specifically  
checked that both “zlib” and “zlib-dev”(or whatever it’s called) are  
installed. Makes no difference.

What’s more intriguing is that the practically identical desktop RH9  
installation (yes, the machine I won’t be using ;( ) has installed it  
just fine. Which is good cause I can have a little play-around. But I  
really do need to have it on the server… Ho-hum…

(I am not sure about the libzlib-ruby, but I didn’t need that on the  
other -desktop- installation)

---

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [July 7, 2006, 9:02pm UTC](https://www.ruby-forum.com/t/problem-installing-gem/97149/4 "2006-07-07T21:02:32Z")

</div>

=BUMP=

No ideas?  
It’s quite frustrating, the system is running fine on the workstation  
atm, but I really need it on the server.

They’re both RH9, everything I could think ofhas been checked.  
I’ve tried re-installing… same problem.

Can anyone at least point me to the lines in the rubygems installer that  
I should be checking?

Thanks again.

---

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [July 7, 2006, 9:43pm UTC](https://www.ruby-forum.com/t/problem-installing-gem/97149/5 "2006-07-07T21:43:46Z")

</div>

> That’s one of the first things that came to mind, so I specifically  
> checked that both “zlib” and “zlib-dev”(or whatever it’s called) are  
> installed. Makes no difference.

Have you tried uninstalling and reinstalling ruby and its related  
packages  
after making sure zlib and zlib-dev are installed?

---

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [July 7, 2006, 9:40pm UTC](https://www.ruby-forum.com/t/problem-installing-gem/97149/6 "2006-07-07T21:40:05Z")

</div>

On 7/7/06, Alex G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> =BUMP=

This is not a forum where this is acceptable behaviour to do that.  
(Frankly, it’s unacceptable behaviour even on web fora, but the  
standards for netiquette have always been lower on web fora than  
anywhere else.) The so-called “Ruby Forum” is a mailing list gateway.  
You just sent a “bump” message to thousands of people and added more  
mail to people who don’t have time to deal with it. Don’t do that  
again.

To your problem. How did you install Ruby? If you installed from  
source and didn’t have zlib and zlib-dev installed when you originally  
built, then you probably need to recompile. If you installed from a  
package, you might be missing something like ruby-zlib. This is more  
common to be missing that on systems where they break Ruby into a  
zillion little pieces (Debian), but who knows? RedHat 9 could have a  
Stupid Ruby Package Setup, too.

Probably does, given what a POS RH9 is.

-austin

---

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [August 5, 2006, 2:46am UTC](https://www.ruby-forum.com/t/problem-installing-gem/97149/7 "2006-08-05T02:46:11Z")

</div>

Well, I finally solved it.

After a month of limping along on an auxilliary server, of installing  
every version of zlib known to man, and of a lot of swearing, I finally  
figued it out!

The problem was that the installation HARDCODED the RELATIVE address of  
zlib in relation to the source code during “configure”. I had moved the  
source directory, considering it to be temporary.

Wow. A hardcoded relative address. Relative to source code. Is that  
good practise?

Once I figured it, a reconfigure and rebuild from the new source  
location sorted everything… Just mentioning it, cuase it might catch  
someone else out, too. Anyway, I’m happy now, everything is working as  
it should. Phew!

---

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [July 8, 2006, 6:26pm UTC](https://www.ruby-forum.com/t/problem-installing-gem/97149/8 "2006-07-08T18:26:27Z")

</div>

Austin Z. wrote:

> > =BUMP=
> 
> This is not a forum where this is acceptable behaviour to do that.  
> Sorry, didn’t realise it was a mailer, too - I use it as a web forum.  
> Wouldn’t have done it if I knew. I felt an honest “bump” was more  
> polite than some contrived reason to post.

> To your problem. How did you install Ruby? If you installed from  
> source and didn’t have zlib and zlib-dev installed when you originally  
> built, then you probably need to recompile.  
> I installed from source.  
> Subsequently, I de-installed everything, got the zlibs and zlib-devs  
> into place and re-compiled. Several times. Tried rubygems-0.9.0, too.  
> Still nothing (or, rather, still the first error msg)

The irritating thing is that it runs just fine on an almost identical  
RH9 setup (which I’m using ATM to get up to speed 🙂 ).

> Probably does, given what a POS RH9 is.  
> Can’t say I share your experience, since my server has been a rock for  
> me for over 5yrs! This is the _first_ weird installation prob. I’ve  
> ever had. I’m just sorry it’s so long in the tooth now, I’d like to  
> keep it going as long as possible. (Ubuntu next, p’haps?)

===

Further with the problem:  
The offending line in the err message points to the file:  
/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb at line 27  
this looks like:  
26\> def require(path)  
27\> gem\_original\_require path  
28\> rescue LoadError =\> load\_error

I can’t say I really see what it’s driving at, though I assume the  
message is the “rescued” load error. Anyone konw what this “path” is  
supposed to be, and where it should be set?

---

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [September 27, 2006, 7:29am UTC](https://www.ruby-forum.com/t/problem-installing-gem/97149/9 "2006-09-27T07:29:52Z")

</div>

Alex G. wrote:

> Well, I finally solved it.
> 
> After a month of limping along on an auxilliary server, of installing  
> every version of zlib known to man, and of a lot of swearing, I finally  
> figued it out!
> 
> The problem was that the installation HARDCODED the RELATIVE address of  
> zlib in relation to the source code during “configure”. I had moved the  
> source directory, considering it to be temporary.

Would you explain what one have to do to do a correct installation, step  
by step, please?

> Wow. A hardcoded relative address. Relative to source code. Is that  
> good practise?
> 
> Once I figured it, a reconfigure and rebuild from the new source  
> location sorted everything… Just mentioning it, cuase it might catch  
> someone else out, too. Anyway, I’m happy now, everything is working as  
> it should. Phew!

---

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [December 30, 2006, 2:25pm UTC](https://www.ruby-forum.com/t/problem-installing-gem/97149/10 "2006-12-30T14:25:45Z")

</div>

Hi all,

I also had this problem, and fixed it by installing ruby-zlib manually.  
The source files is available from  
[http://raa.ruby-lang.org/project/ruby-zlib](http://raa.ruby-lang.org/project/ruby-zlib). Simply extract the files,  
run ruby extconf.rb, make, make install. Running ruby setup.rb in the  
gem source directory then worked fine.

Nick

---

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [December 31, 2006, 1:53am UTC](https://www.ruby-forum.com/t/problem-installing-gem/97149/11 "2006-12-31T01:53:02Z")

</div>

On Dec 30, 2006, at 05:25, Nick Poulden wrote:

> I also had this problem, and fixed it by installing ruby-zlib  
> manually.  
> The source files is available from  
> [http://raa.ruby-lang.org/project/ruby-zlib](http://raa.ruby-lang.org/project/ruby-zlib). Simply extract the files,  
> run ruby extconf.rb, make, make install. Running ruby setup.rb in the  
> gem source directory then worked fine.

No.

zlib is part of ruby since 1.8.

If your ruby doesn’t have the zlib libraries file a bug with your  
ruby packager.

–  
Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)

I LIT YOUR GEM ON FIRE!

---

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [May 22, 2008, 12:19am UTC](https://www.ruby-forum.com/t/problem-installing-gem/97149/12 "2008-05-22T00:19:38Z")

</div>

Lukas Rieder wrote:

> Hello,
> 
> I was struggling with the same problem for about two days.  
> The final solution was installing ruby-zlib and then reinstalling  
> rubygems from source. Dunno why…

Just installed ruby 1.8.6 on CentOS 5 in my local directory. It installs  
a broken gem by default, which crashes on execution:

/myhome/bin/gem:8:in `require’: no such file to load – rubygems  
(LoadError)  
from /myhome/bin/gem:8

Reinstalling rubygems 1.1.1 from source as indicated above fixed it.

Thanks Lukas for the tip, much appreciated!

Isabelle

---

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [April 2, 2008, 6:15pm UTC](https://www.ruby-forum.com/t/problem-installing-gem/97149/13 "2008-04-02T18:15:34Z")

</div>

Hello,

I was struggling with the same problem for about two days.  
The final solution was installing ruby-zlib and then reinstalling  
rubygems from source. Dunno why…

This is quite strange, because my ruby version is 1.8.6, gem version  
1.1.0, zlib and zlib-devel were installed before the installation of  
ruby & rubygems.

But after I’ve installed ruby and rubygems from source I was haunted by  
this error when I tried to install rails. (gem i rails  
–include-dependencies)

/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem\_original\_require’: no such file to load – zlib (LoadError)

This solved my zlib LoadError issue:

wget [http://www.blue.sky.or.jp/atelier/ruby/ruby-zlib-0.6.0.tar.gz](http://www.blue.sky.or.jp/atelier/ruby/ruby-zlib-0.6.0.tar.gz)  
tar xvzf ruby-zlib-0.6.0.tar.gz  
cd ruby-zlib-0.6.0  
ruby extconf.rb && make && make install

(and reinstall your rubygems from source)

Have a nice day,

Lukas Rieder

---

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [September 3, 2008, 8:36pm UTC](https://www.ruby-forum.com/t/problem-installing-gem/97149/14 "2008-09-03T20:36:29Z")

</div>

For reference, that is obsolete as somebody else mentioned.

On Debian, you can build and install RubyGems as long as you have got  
zlib1g-dev before you start your build of Ruby.

Long-dead thread, but it was unresolved…  
removed\_email\_address@domain.invalid

Lukas Rieder wrote:

> This solved my zlib LoadError issue:
> 
> wget [http://www.blue.sky.or.jp/atelier/ruby/ruby-zlib-0.6.0.tar.gz](http://www.blue.sky.or.jp/atelier/ruby/ruby-zlib-0.6.0.tar.gz)  
> tar xvzf ruby-zlib-0.6.0.tar.gz  
> cd ruby-zlib-0.6.0  
> ruby extconf.rb && make && make install
> 
> (and reinstall your rubygems from source)
> 
> Have a nice day,
> 
> Lukas Rieder

---

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [March 28, 2009, 12:20am UTC](https://www.ruby-forum.com/t/problem-installing-gem/97149/15 "2009-03-28T00:20:57Z")

</div>

Lukas Rieder wrote:

> This solved my zlib LoadError issue:
> 
> wget [http://www.blue.sky.or.jp/atelier/ruby/ruby-zlib-0.6.0.tar.gz](http://www.blue.sky.or.jp/atelier/ruby/ruby-zlib-0.6.0.tar.gz)  
> tar xvzf ruby-zlib-0.6.0.tar.gz  
> cd ruby-zlib-0.6.0  
> ruby extconf.rb && make && make install
> 
> (and reinstall your rubygems from source)

That fixed the issue for me as well. Completely stock CentOS 5 install  
(with zlib & zlib-devel)… installed Ruby from source, installed  
Rubygems and boom, zlib load error.

Manually installed ruby-zlib, re-installed Rubygems and away we go.
