Setting up MacPorts on Lion

21 07 2011

Just installed OSX Lion on my MacBook Pro last night and immediately I found my development environment was completely messed up. After the upgrade, all PHP modules I installed previously were gone. Some libraries I installed via MacPorts were gone as well. I tried a few things, “port selfudpate” and “port upgrade outdated”, in an attempt to stabilize the environment with no success. I was getting a lot of dependency issues. That prevented me from installing any more new modules. I read somewhere that installing MacPorts from their Subversion repository should help. I gave it a try and it appeared to have solved my problem.

First of all, check out the trunk from MacPorts, compile and install.
% mkdir -p /opt/mports
% cd /opt/mports
% svn checkout
% cd /opt/mports/trunk/base
% ./configure --enable-readline
% make
% sudo make install
% make distclean

Then, update MacPorts:
# sudo port selfudpate
# sudo port upgrade outdated

You may still encounter some dependency issues. But at this stage, it should be very easy to resolve by temporarily pulling old libraries from Time Machine. For example, I ran into issue with gettext. The Lion upgrade removed this library /opt/local/lib/libintl.8.dylib that was used by gettext but it did not remove gettext completely. MacPorts was confused and refused to reinstall gettext. I had to go back to Time Machine to restore this file temporarily so I can set up gettext again. If you don’t have Time Machine, it would be difficult to acquire these old libraries. If it happens that you need this file, you can download it here.

You will need to force activate the module after you placed the library.
port -f activate gettext

Now, you can uninstall or upgrade the modules.

If you are still encountering dependency issues, try adding/removing binpath in /opt/local/etc/macports/macports.conf.
binpath /bin:/sbin:/usr/bin:/usr/sbin:/opt/local/bin:/opt/local/sbin:/usr/X11R6/bin

Some modules may need this binpath in order to install but most do not require this change.



Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

ERROR: si-captcha.php plugin says GD image support not detected in PHP!

Contact your web host and ask them why GD image support is not enabled for PHP.

ERROR: si-captcha.php plugin says imagepng function not detected in PHP!

Contact your web host and ask them why imagepng function is not enabled for PHP.