One fine evening I was sitting in a Taiwanese café sipping some slightly too sweet tea. While I waited for my bite sized morsels of fried chicken to emerge from their sizzling oil bath, I decided to hack a bit in Ruby.
I could not start immediately, though. I needed some gems to start on my intended task. I attempted to install a gem only to see it fail. I tried a different one. It failed with the same error. Something was amiss.
$ gem install mysql2
ERROR: While executing gem ... (Zlib::GzipFile::Error)
not in gzip format
$
I immediately started to troubleshoot my ruby installation. Had I screwed it up somehow? I had just upgraded XCode.
After a few minutes of troubleshooting I figured out the problem. Ruby and gem were fine. My Internet connection was not. It had timed out and was again redirecting me to the terms of use page. Gem was trying to install the wifi terms of use for the cafe. This was why the gunzip failed ;) The solution involved pretty standard Internet connectivity troubleshooting:
- Open a web browser and navigate to http://www.google.com to trigger the terms of use page
- Once I accepted the terms I cleared my DNS cache with this command on OS X Lion:
dscacheutil -flushcache - I ran gem again and it worked!
$ gem install mysql2 Building native extensions. This could take a while... Successfully installed mysql2-0.3.11 1 gem installed Installing ri documentation for mysql2-0.3.11... Installing RDoc documentation for mysql2-0.3.11...