Cannot Install Ruby Gems - Zlib Error

cannot install ruby gems - zlib error

I just started getting this tonight as well. Googling turned up a bunch of suggestions that didn't deliver results

gem update --system

and some paste in code from jamis that is supposed to replace a function in package.rb but the original it is supposed to replace is nowhere to be found.

Reinstalling rubygems didn't help. I'm reinstalling ruby right now.........and it is fixed. Pain though.

Error installing gems: cannot load such file -- zlib

The following worked for me:

brew install homebrew/dupes/zlib
rvm reinstall 2.2.2 --with-zlib-dir=/usr/local/Cellar/zlib/1.2.8

Hope this helps anyone else who runs into it.

How to fix zlib error in ruby?

Thanks to all of you, My problem solved via this:

aptitude purge ruby

I hope you will find this command useful.

I get this error when installing a gem: ERROR: While executing gem ... (Zlib::GzipFile::Error)

Something isn't set up properly to fetch the gem from GitHub.

try gem fetch -V


steve@macpro:~$ gem fetch blackbook --version ">= 1.0.7" --source http://github.com/tamoyal/blackbook/tree/master -V
GET 301 Moved Permanently: http://github.com/tamoyal/blackbook/tree/master/specs.4.8.gz
GET 200 OK: http://github.com/tamoyal/blackbook/tree/master/
ERROR: While executing gem ... (Zlib::GzipFile::Error)
not in gzip format

You're getting the "not in gzip format" error because gem can't fetch specs.4.8.gz. GitHub returns a 301 redirect back to your project home page, which of course isn't what it wants and isn't gzipped.

Sorry I can't help you further, but I haven't build a gem, much less on GitHub.

ERROR: While executing gem ... (Zlib::GzipFile::Error) not in gzip format

I assume the ERROR occurs since the web sense at my workplace blocks these downloads.

Solution: I downloaded the required gems: chunky_png, fssm, compass, sass, haml etc.. directly from http://rubygems.org/gems and placed these gems in my local directory.

After this I tried gem install compass. This first searches your local directory. On finding the required gems, installation takes place. Does not require connection to the ruby website.

Note: Run the command from the path where the gems are located

eg: I have placed the gems in C:\Ruby193\lib\ruby\gems\1.9.1\gems

So I run the following command :

C:\Ruby193\lib\ruby\gems\1.9.1\gems>gem install compass

Not able to run gem command and build ruby with zlib support

RVM causes more problems than it solves (IMHO). Better tools are ruby-build and rb-env. Newer tools that look very good too are ruby-install and chruby.

Here are my notes from my recent Red Hat Enterprise Linux (RHEL) installation of Ruby, which I believe is pretty similar to Fedora. Perhaps these notes can be of some help to you. Ask me questions if you like.

Install zlib

yum install zlib zlib-devel

Install YAML

export k=yaml v=0.1.4
wget http://pyyaml.org/download/libyaml/$k-$v.tar.gz
tar zxvf $k-$v.tar.gz
cd $k-$v

./configure
make && make install

Install X11 if you want X or headless browsing for testing

yum install 
xorg-x11-fonts-misc
xorg-x11-fonts-truetype
xorg-x11-server-Xorg
xorg-x11-server-Xvfb

Install libraries

yum install 
gdbm gdbm-devel
ncurses ncurses-devel
openssl openssl-devel
readline readline-devel
tk tk-devel
libjpeg libjpeg-devel
libpng libpng-devel
libxml2 libxml2-devel
libxslt libxslt-devel
zlib zlib-devel

Install ruby-build

cd /opt
git clone git://github.com/sstephenson/ruby-build.git
cd ruby-build/
./install.sh

Install Ruby

export k=ruby v=1.9.3-p125
wget http://ftp.ruby-lang.org/pub/ruby/1.9/$k-$v.tar.gz
tar zxvf $k-$v.tar.gz
cd $k-$v

# Either onfigure with defaults...
./configure

# Or configure with custom locations...
./configure --prefix=/opt/$k/$v --enable-shared --with-opt-dir=/opt/yaml/current

make && make check && make install

Environment

Edit /etc/environment to add this:

RUBYOPT='-r rubygems -r psych'

If you put Ruby in a custom directory, also merge this with your existing path:

PATH=/opt/ruby/1.9.3-p125/bin  (or wherever you put it)

Load environment:

source /etc/environment

Verify gem runs and you see the intial set of gems:

gem list

Gem update:

gem update --system


Related Topics



Leave a reply



Submit