Problems w/ Zlib, Ruby, Gems, Rails?

If you experience problems with zlib and rubygems you are not alone. With practically every Rails installation that I’ve done, I have encountered some sort of problem with zlib and rubygems. So, I wanted to highlight my latest installation woes in case anyone else out there could benefit from the steps that I took. Here we go…

I’m starting with a hefty 2 x dual core AMD 64 Opteron machine and this is what I do. - I grab the latest Ruby source (1.8.5). - I’m also a big fan of Yum, the nifty package manager that makes installation and maintenance of Linux machines a breeze (well, not always), so I use Yum to grab needed developer packages like gcc, gcc-cpp, zlib, and the corresponding “-devel” packages. - I configure, make, make install Ruby - I grab the latest RubyGems source (0.9.2) and install it - I then attempt to install Rails with dependencies (gem install rails—include-dependencies), but I get the following error: gzip error installing rake-0.7.2.gem - After searching on the web and finding nothing helpful, I decide to try removing the current ruby gems installation and using rubygems 0.9.0 - Unfortunately, this just causes another error related to zlib: gzip error installing sources-0.0.1.gem - Finally, here’s what fixed the problem: 1) uninstall ruby (recursively delete the main ruby folder) 2) install zlib 1.2.3 from source 3) re-install Ruby 4) re-install RubyGems

Voila—it works! So, the moral of the story is that sometimes the Yum package manager doesn’t install zlib properly and you may need to install from the source.


About this entry