Installing MacPorts (formerly DarwinPorts), I ran into an issue with the post-installation selfupdate command which took some digging to solve. Eventually, I tracked it down to this thread at gmane.org.
Two fixes need to be made: adding a missing line in a text file, and replacing a PPC binary with an Intel-compatible version.
First up, follow the installation instructions at the MacPorts wiki: InstallingMacPorts.
After installation is complete and the installer app is quit:
- Right-click on the .pkg launcher (which is as of this writing called “MacPorts-1.4.0.pkg”) and select “Show Package Contents”.
- Navigate into the “Contents” folder and double-click on the “Archive.pax.gz” file. This will result in an “Archive” folder in your Downloads folder.
- In the Terminal:
cd /opt/local/share/darwinports/Tcl/pextlib1.0 - Open “pkgIndex.tcl” in your favorite Terminal text editor. Assuming vim:
sudo vim pkgIndex.tcl - On the first blank line (below the commented text), add this text all on the same line:
package ifneeded Pextlib 1.0 [list load [file join Pextlib.dylib]] - Save and quit the editor.
- Backup the incompatible binary just in case:
mv Pextlib.dylib Pextlib.dylib.old - Use the command
open .to reveal this directory in a Finder window. - Leaving this window open, open a second Finder window and go to the corresponding folder in the Archive you extracted in step 2. It will be at “Archive/opt/local/share/darwinports/Tcl/pextlib1.0”
- Copy the “Pextlib.dylib” file from the Archive into the permanent folder.
Back in the Terminal, your sudo port selfupdate command should work now. You can trash the Archive folder and Archive.paz file from your Downloads folder.
Note: see comments for another approach in step 5 that worked for at least one visitor.
And for your reference, here’s the original error message I got when I first ran the selfupdate:
can't find package Pextlib 1.0
while executing
"package_native require Pextlib 1.0"
("eval" body line 1)
invoked from within
"eval package_native $args"
(procedure "package" line 14)
invoked from within
"package require Pextlib 1.0"
(procedure "dportinit" line 315)
invoked from within
"dportinit ui_options global_options global_variations"
Error: /opt/local/bin/port: Failed to initialize ports system,
can't find package Pextlib 1.0




