If you are running through the issues like:
ERROR: Loading command: install (LoadError)
no such file to load — zlib
ERROR: While executing gem … (NameError)
uninitialized constant Gem::Commands::InstallCommand
This means, zlib was not installed while compiling Ruby (it’s a question though why it has been kept optional when it’s so required), so you can simply compile it later and fix the above issues.
Install the zlib dev libraries
sudo apt-get install zlib1g-dev
Then go to the source directory from where you compiled the Ruby and there you will find source for zlib.
e.g. /usr/local/src/ruby-1.8.7/ext/zlib
In case, if you used RVM, then it will be here
cd /home/user/.rvm/src/ruby-1.8.7-p352/ext/zlib
And do the following commands
ruby extconf.rb make make install
And that’s it.



