Macports can’t find zlib.dylib – my solution


Untitled

As some of you know I recently upgraded my mac to Snow Leopard (10.6). Since I do not believe in “Upgrade installations” this meant having to reinstall all my software after formatting the drive and installing OS X. Being a Unix-poweruser one of the first thing I installed was Macports to give me easy access to Apache, Mysql, PHP and other software. Using macports I also tried to install freetype to go with my newly installed copy of Wine. But then the fun stopped – it failed!

Error: Target org.macports.extract returned: lipo: can't open input file: /opt/local/lib/libz.dylib (No such file or directory)

For some reason the auto-installed (by dependencies) zlib did not install zlib.dylib. I tried to reinstall zlib using port but without luck.

But I did find an another solution to the problem. It turns out that zlib compiles just fine under Snow Leopard without ports! My solution – the short version: Download and install zlib separately and then copy it to /opt/local/lib.

My solution – the almost too short version:

cd /usr/local/src
wget http://www.zlib.net/zlib-1.2.3.tar.gz
tar xvzf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --shared
make
sudo make install
cp /usr/local/lib/zlib* /opt/local/lib/

Done! Replace /usr/local/src with a directory of your liking…

It might not be the best, or the only, solution to the problem but it worked for me. Since I guess that this post might help others I wrote it in English.

, , ,

  1. #1 by Yegor - October 28th, 2009 at 11:43

    Thank you very much, I experienced the same problem. You saved me :)

  2. #2 by Hardy - October 28th, 2009 at 17:03

    You can also just run:

    sudo port install zlib +universal

    I had the same problem and the command above resolved it :)

  3. #3 by robe5 - December 14th, 2009 at 23:38

    Hardy :
    You can also just run:
    sudo port install zlib +universal
    I had the same problem and the command above resolved it :)

    Thanks a lot! You saved my day!

  4. #4 by jrivero - January 1st, 2010 at 03:58

    nice! i use the last command suggest by Hardy and port work already

(will not be published)
  1. No trackbacks yet.