15

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.

Community
  • 1
  • 1
Michael Gruber
  • 601
  • 2
  • 11
  • 24

4 Answers4

9

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.

greggles
  • 2,089
  • 5
  • 20
  • 38
Stephane Paquet
  • 2,315
  • 27
  • 31
3

This fixed it for me:

brew untap homebrew/dupes
brew tap homebrew/dupes

Then continue:

brew install zlib
brew list zlib

Reference: https://github.com/Homebrew/homebrew-php/issues/205

edigu
  • 9,878
  • 5
  • 57
  • 80
John Magnolia
  • 16,769
  • 36
  • 159
  • 270
1

Today, after running brew upgrade, git stopped working. I also got a load error for zlib, when I try to run git. After the following:

  1. brew remove git
  2. brew cleanup
  3. brew install git

the problem is gone and git is working again. Thanks @Stephane

I think this might be helpful for others too, so posted it here.

wiser
  • 179
  • 1
  • 7
0

In my case I had to remove php (php54 for me), cleanup, tap josegonzalez/php, then reinstall php.

brew remove php54
brew cleanup
brew tap josegonzalez/php
brew install php54
doublesharp
  • 26,888
  • 6
  • 52
  • 73