Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Homebrew updated zlib and broke everything

So a brew update updated zlib from 1.2.7 to 1.2.8. Yay.

Later I noticed there was an issue running bundle. I was getting a LoadError for zlib.

Error loading RubyGems plugin "/Users/michael/.rvm/gems/ruby-2.0.0-p0@global/gems/rubygems-bundler-1.1.1/lib/rubygems_plugin.rb": dlopen(/Users/michael/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/x86_64-darwin12.3.0/zlib.bundle, 9): Library not loaded: /usr/local/opt/zlib/lib/libz.so.1.2.7
  Referenced from: /Users/michael/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/x86_64-darwin12.3.0/zlib.bundle
  Reason: image not found - /Users/michael/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/x86_64-darwin12.3.0/zlib.bundle (LoadError)

brew doctor says:

dyld: Library not loaded: /usr/local/opt/zlib/lib/libz.so.1.2.7
  Referenced from: /usr/local/bin/php
  Reason: image not found

Tried brew tap homebrew/dupes as per this, got Error: Already tapped!, of course

Next tried rvm reinstall 2.0.0. Now bundle works but rails s still does not.

/Users/michael/.rvm/gems/ruby-2.0.0-p0@rails3/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require': dlopen(/Users/michael/.rvm/gems/ruby-2.0.0-p0@rails3/gems/nokogiri-1.5.9/lib/nokogiri/nokogiri.bundle, 9): Library not loaded: /usr/local/opt/zlib/lib/libz.so.1.2.7 (LoadError)
  Referenced from: /usr/local/opt/libxml2/lib/libxml2.2.dylib
  Reason: image not found - /Users/michael/.rvm/gems/ruby-2.0.0-p0@rails3/gems/nokogiri-1.5.9/lib/nokogiri/nokogiri.bundle

Anyone know how to fix this?

Update

Managed to get my everything working, for now, with a cp /usr/local/opt/zlib/lib/libz.so.1.2.8 /usr/local/opt/zlib/lib/libz.so.1.2.7. The jankiest of fixes. If anyone has a real solution to this I'd be much obliged.

like image 401
Michael Gruber Avatar asked May 02 '13 22:05

Michael Gruber


1 Answers

Yep, I do propose the following:

  1. brew remove php53 (or php54) You can even be more aggressive if needed, just to make sure that no previous installation of php is on your Mac.
  2. (optional) do a brew cleanup. I did not do it and things have been fixed.
  3. brew install php53 (or php54)

Then, php -v will give you a nice:

PHP 5.3.23 (cli) (built: May  6 2013 16:18:42)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
    with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans

No more complaints about a missing lib or anything else.

like image 107
Stephane Paquet Avatar answered Sep 22 '22 14:09

Stephane Paquet