Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I decided to install gem in ubuntu yesterday ( with this command : sudo gem install algorithms ) , bash gave me an error. How can I install gem in ubuntu like that installing on windows ?

***** This is a screenshot from my Terminal *********

enter image description here


share|improve this question

migrated from Aug 29 '11 at 22:39

This question came from our site for professional and enthusiast programmers.

closed as too localized by Marco Ceppi Jan 23 '12 at 20:34

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Found this on SO but someone ruby-smart should review those answers for an up to date one:… – Jorge Castro Aug 29 '11 at 22:58
Question abandoned? – Caesium Jan 23 '12 at 17:03

"No such file to load -- zlib" - gem cannot be installed because it needs library dependency to be installed first. In this case:

sudo apt-get install zlib1g zlib1g-dev

Then try to install the algorithms gem again, it should work.

share|improve this answer

Ah, thanks for the screenshot. Not being snarky, just saving space. I believe your answer is in another thread: Ubuntu noob rails install fails on zlib

share|improve this answer

This should be solved by following the instructions here (Link takes you to a Ask Ubuntu answer) and then trying to install the gem again.

share|improve this answer

If you could put the error message here, it will much easier to get help.

Right now, I have to guess, did you installed RubyGems already?

After that you may also need doing

sudo gem update --system

Basically you need install zlib first, and using rvm to remove and re-install Ruby. I remembered I did using rvm to install Ruby on Rails last time on Ubuntu 10.04 as well.

In a ideal world, apt should be the one stop shop for every package and will automatically resolve dependency for you. But it probably will never working that way, unless your package management could compile for you as well when necessary. Gentoo handle Ruby installation slightly better without need rvm to manage Ruby and then Gems manage gems. But using Gentoo to install Gems is not easier either.

I always thinking Ubuntu or other Linux package manager systems like Portage is much ore better than what Windows have, but in the case of install Ruby Gems Linux doesn't seems any significant simpler or better.

share|improve this answer
I modify my post with error message. – amir amir Aug 29 '11 at 22:20
I couldn't vote up yet:( But Both Daniel's or Jorge's link should lead you to right direction. – pstar Aug 29 '11 at 23:16

Install rvm on you ubuntu and install ruby 1.9.2 or any. then you can create a gemset with

rvm 1.9.2@blabla --create

and run gem install algorithms

share|improve this answer
Excuse me , what is the rvm ? how can I install it ? – amir amir Aug 29 '11 at 22:07
sorry i cant rember how i did it cos its been a wile but just did some google search and found this link… – Uchenna Okafor Aug 29 '11 at 22:14
rvm means ruby version manager – Uchenna Okafor Aug 29 '11 at 22:15
-1 RVM has nothing to do with this, nor it helps with this problem – Lukas Stejskal Aug 30 '11 at 12:52