If you used MacPorts on Mac OS X (Leopard) and you went ahead with the Snow Leopard upgrade, not realizing that it would break MacPorts, then the next time you ran a port command, you probably got an error message like this:
dlopen(/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib, 10): no suitable image found. Did find:
/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib: mach-o, but wrong architecture
while executing
"load /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib"
("package ifneeded Pextlib 1.0" script) invoked from within
"package require Pextlib 1.0"
(file "/opt/local/bin/port" line 40)
You fed the error message into Google, and now here you are!
When you travel to MacPorts to find out how to upgrade, you wind up on the Macports Migration page, where it tells you to save a list of your installed ports by running the command:
port installed > myports.txt
Then clean any partially completed builds, and uninstall all installed ports:
sudo port clean installed
sudo port -f uninstall installed
But, er, uhm, your MacPorts installation is broken, remember? Meaning that when you try to run the commands above, you just get the error message above.
Maybe I’m the only one dumb enough not to realize that it’s okay to download and install the MacPorts Snow Leopard upgrade from here and then proceed with the above commands. For some reason I had the mistaken impression that I had to totally uninstall the old MacPorts, first. Not necessary, at least not for me.
Note, before installing the Macports Snow Leopard upgrade, you must first install the new Xcode from the custom folder of your Snow Leopard install disk, as explained at the MacPorts install page. Some even suggest that you must install from the disk and NOT from the Apple Developer site.
Other than that, everything works out just peachy.
Also note, that if you are a MacVim user, there is a temporary build available for Snow Leopard here, courtesy of the ever-generous Björn Winckler.

{ 7 comments… read them below or add one }
Many Thanks ! You just saving me so long debugging time !
Do I really have to delete all programs I already instlled with macports? There was only the macport which didn’t work but the programs are still working fine…
Nora,
Best directions are here:
http://trac.macports.org/wiki/Migration
As you see from the first paragraph, some of the installed ports MAY continue to work, but eventually things will break because you are using programs meant for Leopard on Snow Leopard.
The instructions are to reinstall Xcode and MacPorts, then proceed . . . .
Good luck,
Rick
Thanks for spelling this out for me. You’ve saved my day!
Thank you so very much!
To be fair, the Migration page does say “you will first need to install the base MacPorts system again, either from the appropriate disk image or from source.”
Yes, it broke, upgraded MacPorts, installed the new Xcode, and googled until I stumbled on your post
I didn’t know there was a migration page, I remember just having grabbed the latest version. All my ports work marvelously well again (after manually fixing/removing some remains of the old installation like /opt/local/share/terminfo)
Thanks much!