# Gem problem installing Rails / Ubuntu Gutsy

**URL:** <https://www.ruby-forum.com/t/gem-problem-installing-rails-ubuntu-gutsy/124360>\
**Category:** Ruby\
**Created:** [December 28, 2007, 12:28am UTC](https://www.ruby-forum.com/t/gem-problem-installing-rails-ubuntu-gutsy/124360 "2007-12-28T00:28:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![caiwangqin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4bbf92/32.png) [@caiwangqin](https://www.ruby-forum.com/u/caiwangqin)\
**Post date:** [December 28, 2007, 12:28am UTC](https://www.ruby-forum.com/t/gem-problem-installing-rails-ubuntu-gutsy/124360/1 "2007-12-28T00:28:58Z")

</div>

Please take a look at the following. I try to make it clear what my  
problems are…

[http://pastie.caboo.se/132571](http://pastie.caboo.se/132571)

---

<div class="post-metadata">

**Author:** ![caiwangqin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4bbf92/32.png) [@caiwangqin](https://www.ruby-forum.com/u/caiwangqin)\
**Post date:** [December 28, 2007, 12:39am UTC](https://www.ruby-forum.com/t/gem-problem-installing-rails-ubuntu-gutsy/124360/2 "2007-12-28T00:39:32Z")

</div>

-------- Original-Nachricht --------

> Datum: Fri, 28 Dec 2007 08:28:59 +0900  
> Von: Jesse C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> An: removed\_email\_address@domain.invalid  
> Betreff: Gem problem installing Rails / Ubuntu Gutsy

> Please take a look at the following. I try to make it clear what my  
> problems are…
> 
> ## [Parked at Loopia](http://pastie.caboo.se/132571)
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

Hi,

you don’t have zlib installed. ([http://www.zlib.net/](http://www.zlib.net/))

Best regards,

Axel

---

<div class="post-metadata">

**Author:** ![caiwangqin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4bbf92/32.png) [@caiwangqin](https://www.ruby-forum.com/u/caiwangqin)\
**Post date:** [December 28, 2007, 12:55am UTC](https://www.ruby-forum.com/t/gem-problem-installing-rails-ubuntu-gutsy/124360/3 "2007-12-28T00:55:23Z")

</div>

Axel E. wrote:

> -------- Original-Nachricht --------
> 
> > Please take a look at the following. I try to make it clear what my  
> > problems are…
> > 
> > [Parked at Loopia](http://pastie.caboo.se/132571)
> 
> Hi,
> 
> you don’t have zlib installed. ([http://www.zlib.net/](http://www.zlib.net/))
> 
> Best regards,
> 
> Axel

Hello, and thank you. I installed zlib using ./configure; make test;  
make install, tho I still get the same errors… (?)

for `whereis zlib` : zlib:  
for `whatis zlib` : nothing appropriate

Thanks,  
Jess

---

<div class="post-metadata">

**Author:** ![caiwangqin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4bbf92/32.png) [@caiwangqin](https://www.ruby-forum.com/u/caiwangqin)\
**Post date:** [December 28, 2007, 1:35am UTC](https://www.ruby-forum.com/t/gem-problem-installing-rails-ubuntu-gutsy/124360/4 "2007-12-28T01:35:06Z")

</div>

On Fri, Dec 28, 2007 at 08:55:18AM +0900, Jesse C. wrote:

> > Hi,  
> > for `whereis zlib` : zlib:  
> > for `whatis zlib` : nothing appropriate
> 
> Thanks,  
> Jess

Hi…

ehm why you use the package managment (apt?) to install gem etc. and  
compiling zlib from source? apt-get install zlib1g-dev does it fine.

P.S. I use my ruby environment basically from Ubuntu and all the gem  
stuff from the ruby community. So I don’t have trouble with the  
package management for upgrades in the future.

Greetings  
Mario

---

<div class="post-metadata">

**Author:** ![caiwangqin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4bbf92/32.png) [@caiwangqin](https://www.ruby-forum.com/u/caiwangqin)\
**Post date:** [December 28, 2007, 2:28am UTC](https://www.ruby-forum.com/t/gem-problem-installing-rails-ubuntu-gutsy/124360/5 "2007-12-28T02:28:00Z")

</div>

Mario G. wrote:

> On Fri, Dec 28, 2007 at 08:55:18AM +0900, Jesse C. wrote:
> 
> ehm why you use the package managment (apt?) to install gem etc. and  
> compiling zlib from source? apt-get install zlib1g-dev does it fine.
> 
> P.S. I use my ruby environment basically from Ubuntu and all the gem  
> stuff from the ruby community. So I don’t have trouble with the  
> package management for upgrades in the future.
> 
> Greetings  
> Mario

same problems after apt installing zlib1g-dev

results: [Parked at Loopia](http://pastie.caboo.se/132604)

further, I installed Ruby and Gems from source (I believe), tho I am a  
newb; so, can you please explain your post script to me?

Thanks,  
Jess

---

<div class="post-metadata">

**Author:** ![caiwangqin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4bbf92/32.png) [@caiwangqin](https://www.ruby-forum.com/u/caiwangqin)\
**Post date:** [December 28, 2007, 4:32am UTC](https://www.ruby-forum.com/t/gem-problem-installing-rails-ubuntu-gutsy/124360/6 "2007-12-28T04:32:52Z")

</div>

On Fri, Dec 28, 2007 at 10:27:55AM +0900, Jesse C. wrote:

> same problems after apt installing zlib1g-dev
> 
> results: [Parked at Loopia](http://pastie.caboo.se/132604)
> 
> further, I installed Ruby and Gems from source (I believe) …

If you didn’t have the -dev zlib package installed when you compiled  
Ruby from source, the Ruby zlib extension can’t have been built.

Its a little confusing because two subtly different things share the  
same name - a plain old C shared library, and a ruby extension that  
uses it. It’s the latter part that is being complained about in those  
error messages.

Try rebuilding now that you have the -dev package installed, and see  
if that helps.

Note that you’ll probably find that other extensions bundled with the  
interpreter are missing if you don’t have the requisite -dev packages  
when you build.

---

<div class="post-metadata">

**Author:** ![caiwangqin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4bbf92/32.png) [@caiwangqin](https://www.ruby-forum.com/u/caiwangqin)\
**Post date:** [December 28, 2007, 5:07am UTC](https://www.ruby-forum.com/t/gem-problem-installing-rails-ubuntu-gutsy/124360/7 "2007-12-28T05:07:52Z")

</div>

Stephen L. wrote:

> > Jesse C. wrote:
> > 
> > same problems after apt installing zlib1g-dev
> > 
> > results: [Parked at Loopia](http://pastie.caboo.se/132604)
> > 
> > further, I installed Ruby and Gems from source (I believe) …
> 
> If you didn’t have the -dev zlib package installed when you compiled  
> Ruby from source, the Ruby zlib extension can’t have been built.
> 
> Its a little confusing because two subtly different things share the  
> same name - a plain old C shared library, and a ruby extension that  
> uses it. It’s the latter part that is being complained about in those  
> error messages.
> 
> Try rebuilding now that you have the -dev package installed, and see  
> if that helps.
> 
> Note that you’ll probably find that other extensions bundled with the  
> interpreter are missing if you don’t have the requisite -dev packages  
> when you build.

Whoa. I am confused. Thanks so much for helping, but nothing seems to  
work. I had a similar problem with MySQL, and it turned out all I had  
to do was reboot.

this is all i can think to do: whereis zlib  
zlib: /usr/include/zlib.h /usr/share/man/man3/zlib.3.gz

Say I want to start from scratch. Can this be done without a fresh OS  
install?

---

<div class="post-metadata">

**Author:** ![caiwangqin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4bbf92/32.png) [@caiwangqin](https://www.ruby-forum.com/u/caiwangqin)\
**Post date:** [December 28, 2007, 6:42am UTC](https://www.ruby-forum.com/t/gem-problem-installing-rails-ubuntu-gutsy/124360/8 "2007-12-28T06:42:40Z")

</div>

It really shouldn’t be a problem to start over.

Find all the ruby packages installed with  
$\> dpkg -l | grep -i ruby

Then remove each of them  
$\> sudo apt-get remove --purge ruby rdoc rubygems rails (etc…)

Then reinstall.

These days I’m really not sure what to recommend to people in terms of  
how  
to install ruby and gems on ubuntu.

Usually I run my production machines with Ruby and Gems from apt and  
Rails  
from Gems. Which would require something like…  
$\> sudo apt-get install ruby rdoc ri ruby-extras ruby-gems  
$\> sudo gem install rails

Doing it from source (especially if it’s a development machine) is  
really  
easy also. The trick in Ubuntu is to use apt to install all the  
dependencies before building the source package. So you’d do something  
like…  
$\> sudo apt-get build-dep ruby rdoc ri ruby-extras ruby-gems

Then download and install the source packages.

The same trick works with the database gems. If your going to install  
the  
mysql, postgres or sqlite gem install their coresponding apt package  
dependencies first, then the gem  
$\> sudo apt-get build-dep libmysql-ruby1.8 libsqlite3-ruby1.8  
libpgsql-ruby1.8  
$\> gem install mysql sqlite postgres

I just made a blog post about running all three side by side that may  
help  
also.

[http://blog.michaelgreenly.com/2007/12/multiple-ruby-version-on-ubuntu.html](http://blog.michaelgreenly.com/2007/12/multiple-ruby-version-on-ubuntu.html)

---

<div class="post-metadata">

**Author:** ![caiwangqin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4bbf92/32.png) [@caiwangqin](https://www.ruby-forum.com/u/caiwangqin)\
**Post date:** [December 28, 2007, 6:58am UTC](https://www.ruby-forum.com/t/gem-problem-installing-rails-ubuntu-gutsy/124360/9 "2007-12-28T06:58:52Z")

</div>

Michael G. wrote:

> . . . .
> 
> I just made a blog post about running all three side by side that may  
> help  
> also.
> 
> [http://blog.michaelgreenly.com/2007/12/multiple-ruby-version-on-ubuntu.html](http://blog.michaelgreenly.com/2007/12/multiple-ruby-version-on-ubuntu.html)

Thanks so much. In the meantime I had solved it for my purposes.

1. sudo apt-get install --reinstall zlib1g zlib1g-dev
2. in ~/ruby-1.8.6/ \_\_ sudo ./configure; sudo make; sudo make install
3. in ~/rubygems-1.0.1/ \_\_ sudo ruby setup.rb

ruby -v returns 1.8.6  
gem -v returns 1.0.1

sudo gem update --system \_\_ works  
sudo gem install rails \_\_ works

Yay !
