ERROR: While executing gem … (Zlib::BufError) in windows

So today I’m trying to update my gems and I get this error on random gems like rspec-rails but rspec updated fine.

I googled the issue and found great articles on the error, unfortunately none of them really worked. This brought me to posting what I did to fix it the error.

First, based on dontrepeatyourself, I updated to the latested gem system (version 1.3.3).
gem update --system
Based on what I’ve read on the site, it fixed the issue for a lot of people (keep in mind this is an article from 2007) but it didn’t fix my issue. I continued looking for another solution, and I found a bunch of Window’s specific fixes that involved altering ruby code which I wasn’t going to attempt. Some article comments said to re-install ruby but who has time for that? Other posts (in the comments) said to download windows specific GZip ports but that also had no effect. I even installed a zliby gem hoping it would replace the Zlib but that still didn’t work. So I did what every windows user should do when the problem isn’t getting fixed, REBOOT!. After the reboot, gems updated without a problem (well except of the usual SQLite3 update error on windows

Long story short

try calling
gem update --system
And then Reboot your system and see if that fixes it

Please leave me a comment to let me know if this helped you

2 Responses to “ERROR: While executing gem … (Zlib::BufError) in windows”

  1. Al Scherer said:

    Jun 10, 09 at 10:51 PM

    I ran into the same problem on Windows Vista. Reboot did not help.

  2. andrew.kalek said:

    Jun 24, 09 at 10:10 AM

    Al,
    I’m sorry that it didn’t help but if you figured out the fix, please let me know how you did it and I’ll update the post ;)