After installing ruby 1.8.6 on Windows 7 I tried to install rake and received this error:
C:\>gem install rake ERROR: While executing gem ... (Zlib::GzipFile::Error) not in gzip format
It was annoying to resolve so I’m posting what worked for me.
Find out where your ruby is configured to look for sources:
C:\>gem sources *** CURRENT SOURCES *** http://gems.rubyforge.org/
If it is pointed at gems.rubyforge.org (which it is when first installed) then you’re pointed at the old web server so when ruby tries to get updates it gets an HTTP redirect (302) as a response instead of the expected data in GZIP format. It apparently doesn’t have an error handler configured to detect the redirect so it just gives up.
To fix it you have to update the list of sources. First add the correct source:
C:\>gem sources -a http://rubygems.org/ http://rubygems.org/ added to sources
Then remove the deprecated one:
C:\>gem sources -r http://gems.rubyforge.org/ http://gems.rubyforge.org/ removed from sources C:\>gem sources *** CURRENT SOURCES *** http://rubygems.org/
Next update your ruby system:
C:\>gem update --system Updating RubyGems Updating rubygems-update Successfully installed rubygems-update-1.3.7 :0:Warning: Gem::SourceIndex#search support for String patterns is deprecated Updating RubyGems to 1.3.7 Installing RubyGems 1.3.7 RubyGems 1.3.7 installed ∩╗┐=== 1.3.7 / 2010-05-13 NOTE: http://rubygems.org is now the default source for downloading gems. You may have sources set via ~/.gemrc, so you should replace http://gems.rubyforge.org with http://rubygems.org http://gems.rubyforge.org will continue to work for the forseeable future. ...
Note that update verifies that the old source URL is no longer valid…
You should now be able to continue your installation, which in my case was rake.
C:\>gem install rake Successfully installed rake-0.8.7 1 gem installed Installing ri documentation for rake-0.8.7... Installing RDoc documentation for rake-0.8.7...