HomeRamblings  ⁄  SystemsMacsSetups

macports is not darwinports

Published: June 23, 2009 (over 8 years ago)
Updated: over 2 years ago

For those of you who don’t keep a close eye on the macports system that provides you with convenient builds of popular open source software, let me put you on guard: macports supplanted darwinports a few years back to avoid continued confusion over the name. I was having a good bit of trouble getting ports to install ImageMagick and have had trouble many other times getting ports to install things. As such, I often fell back on fink or compiling and installing from source rather than figuring out the root causes of my macports problems. Macports was surprisingly easy to fix up and get fully operational again, and this was on a fairly old machine that I am pretty certain I started with “Darwin Ports” roughly 3.5 years ago.

First Thing’s First

First, know that the official macports website is: trac.macports.org. Be wary of anything “darwinports” as name is officially retired in favor of “macports.”

Trouble a-brewing

It all started innocently enough. I wanted to install ImageMagick on my mac. I’ve been through installing ImageMagick on Linux and knew it was not going to be a cakewalk to install from source. ImageMagick simply has too many dependencies to relish the thought of an install from source route. So I googled and found instructions for ports and began:

sudo port install tiff -macosx imagemagick +q8 +gs +wmf
Warning: Group file could not be located.
--->  Activating tiff 3.8.2_3
Error: Target org.macports.activate returned: Image error: Another version of this port (tiff @3.8.2_2+darwin_9+macosx) is already active.

Oh, ok, lets remove the old one…

sudo port uninstall tiff -macosx imagemagick +q8 +gs +wmf
--->  The following versions of tiff are currently installed:
--->    tiff @3.8.2_2+darwin_9+macosx (active)
--->    tiff @3.8.2_3
Error: port uninstall failed: Registry error: Please specify the full version as recorded in the port registry.
[mwlang@macdoze shared] sudo port uninstall tiff @3.8.2_2+darwin_9+macosx 
--->  Unable to uninstall tiff 3.8.2_2+darwin_9+macosx, the following ports depend on it:
--->    gtk2
--->    lcms
--->    sane-backends
--->    xsane
Error: port uninstall failed: Please uninstall the ports that depend on tiff first.
[mwlang@macdoze shared] sudo port uninstall tiff @3.8.2_2+darwin_9+macosx gtk2 lcms sane-backends xsane
--->  Unable to uninstall tiff 3.8.2_2+darwin_9+macosx, the following ports depend on it:
--->    gtk2
--->    lcms
--->    sane-backends
--->    xsane
Error: port uninstall failed: Please uninstall the ports that depend on tiff first.
[mwlang@macdoze shared] sudo port uninstall gtk2 lcms sane-backends xsane
--->  Unable to uninstall gtk2 2.12.9_0+x11, the following ports depend on it:
--->    gconf
--->    gnome-keyring
--->    libglade2
--->    gail
--->    libgnomecanvas
--->    libbonoboui
--->    poppler
--->    py25-gtk
--->    gtk-nodoka-engine
--->    xsane
Error: port uninstall failed: Please uninstall the ports that depend on gtk2 first.

Not a very auspicious start, is it? Time to step back and think about this one and dig into the macports facility to learn how to properly manage things. New strategy: Get an education.

Discovering Deactivate/Activate

So, looking at the above problem, I realized that there was almost certainly an easier route out of this dependency nightmare and I needed to learn how to upgrade those old, stale packages. Going through the docs reveals activate and deactivate commands. Sounds perfect, lets try:

sudo port activate tiff @3.8.2_3
--->  Activating tiff @3.8.2_3
Error: port activate failed: Image error: Another version of this port (tiff @3.8.2_2+darwin_9+macosx) is already active.
[mwlang@macdoze shared] sudo port deactivate tiff @3.8.2_2+darwin_9+macosx
--->  Deactivating tiff @3.8.2_2+darwin_9+macosx
[mwlang@macdoze shared] sudo port activate tiff @3.8.2_3
--->  Activating tiff @3.8.2_3

So there’s the kicker. First, deactivate the old version, then activate the new version.

So Macports itself is out of date, you say?

sudo port install tiff -macosx imagemagick +q8 +gs +wmf
Error: Unable to execute port: invalid command name "use_autoreconf"

I had no clue what this was. Googling around was turning up precious little. So I hopped over into the IRC #macports channel. Right off the bat, Toby tells me to selfupdate. I had made the mistake of thinking that “sudo port sync” was keeping macports packages all up to date in one fell swoop. But the two are two distinct activities. So remember to keep ports itself updated with this:

sudo port selfupdate

With that, port was upgraded from a very old version to a bright and shiny new version. Time to try to install ImageMagick again. And I’m happy to report that I got much further along this time. But still hit a roadblock…

Mysterious failure demystified

A little down the chain of installing various xorg packages, I hit upon this one with the xorg-libx11 package:

checking for XPROTO... configure: error: Package requirements (xproto >= 7.0.13) were not met.
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively you may set the XPROTO_CFLAGS and XPROTO_LIBS environment variables
to avoid the need to call pkg-config.  See the pkg-config man page for
more details.

Error: The following dependencies failed to build: ghostscript xorg-libXext xorg-libX11 xorg-libXt xorg-libsm xorg-libice
Error: Status 1 encountered during processing.
[mwlang@macdoze shared] sudo port install ImageMagick
Error: Requested variants do not match original selection.
Please perform 'port clean ImageMagick' or specify the force option.
Error: Status 1 encountered during processing.

Strange, what’s that xproto >= 7.0.13? How odd that a dependency would fail! I tried a sudo port install xproto, but that was a no-go (so don’t bother trying, it’ll fail for you, too). but then I noticed the dependency list (which oddly is missing xorg-xproto) and most of the packages are prefixed with “xorg-“, and tried sudo port install xorg-xproto and thus, was on my way again.

I lie! I lie! I had no clue. I googled “xproto port install” and learned the truth for the real package name that way. However, as it happens, I found the answer on darwinports dot com in a dependency list for xorg-libx11. I casually mentioned this site in the IRC channel and the #macports tenants were very quick to point out was an imposter site, so be wary of anything you read and learn there. Information is liable to be stale while the site owner attempts to lighten your wallet a bit for no good cause. Little did I know!

Final tidbit

Once I got the ports system updated and the xproto package installed, it was a fair breeze to finish with the ImageMagick installation. One last command I learned from the good folks in #macports is to run the following on a frequent basis to keep your macports installation in fair good shape:

sudo port selfupdate && sudo port upgrade outdated

Conclusion

For years, I struggled with ports, and for no good reason. Once I took the time to learn the package management’s commands (along with the help of those in #macports, for which I’m very grateful to them for saving me a few hours of head-scratching), I am finding I’m able to install packages painlessly on the mac and have even tried a couple of others I had problems with in the past and they’re all installing without a hitch. The lesson for me: take the time to learn your tools. It may be slow-going at first, but the rewards always seem to pay back big dividends down the road.

comments powered by Disqus