problem initializing macports

Ryan Schmidt ryandesign at
Mon Nov 26 03:59:39 PST 2007

On Nov 26, 2007, at 04:39, tania habib wrote:

> I have Macbook Pro with mac osx 10.4, I previously installed the
> macports on the same machine and it was running perfectly. Then I did
> not use it for a while and now when I go to the terminal window, and
> type port it gives me this error
> no suitable image found.  Did find:
>         /opt/local/share/darwinports/Tcl/pextlib1.0/Pextlib.dylib:
> mach-o, but wrong architecture
>     while executing
> "load /opt/local/share/darwinports/Tcl/pextlib1.0/Pextlib.dylib"
>     ("package ifneeded" script)
>     invoked from within
> "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 311)
>     invoked from within
> "dportinit ui_options global_options global_variations"
> Error: /opt/local/bin/port: Failed to initialize ports system, no
> suitable image found.  Did find:
>         /opt/local/share/darwinports/Tcl/pextlib1.0/Pextlib.dylib:
> mach-o, but wrong architecture
> Should I uninstall the whole thing and start from the beginning or is
> there any other way?

I'd like to know what architecture the pextlib library is on your  
computer... What is the output of this command?

file /opt/local/share/darwinports/Tcl/pextlib1.0/Pextlib.dylib

It should say it's an i386 library. If it says it's a ppc library,  
then that's certainly the problem, though I can't imagine how it  
happened, if you didn't migrate your installation from a PowerPC  

> I have tried this command
>>> cd /opt/local/var/db/dports/receipts/
>>> find . -name receipt.bz2 | sed -E 's%^\./(.*)/(.*)/receipt\.bz2$% 
>>> \1 @\2%'
> but I do not know what to do next!

What output does this produce? The goal is to get a list of the  
installed ports and their variants so that if you need to reinstall  
the whole mess, then you'll know what ports to reinstall.

If you already know what ports you want to have, and what variants of  
those ports you want, you don't need this list.

> Please let me know an easier way out of this mess!

Short of a complete uninstall and reinstallation, it's hard to  
suggest a solution, since we don't yet know the cause of the problem.  

You could try installing MacPorts again, on top of your existing  
installation. If any files are missing or wrong, this should fix it.  
This is also what was suggested in a previous thread about this error  

Note that you can't use the installer for MacPorts 1.5.0 or later, as  
that will almost certainly not work, and will make a big mess, since  
the internal layout of MacPorts has radically changed from the layout  
that your version uses. The "selfupdate" process takes this into  
account and rearranges your MacPorts layout if necessary, but the  
disk image installer does not, as far as I know. The new layout  
appeared in MacPorts 1.5.0, so you must be using MacPorts 1.4.x or  
earlier. So you would want to use the MacPorts 1.4.0 installer. 

Once that's installed, the port command should work again. And then  
"sudo port selfupdate" would hopefully update you to MacPorts 1.5.2.  
And "port outdated" will show you which of your ports have newer  
versions available. And "sudo port upgrade foo" will upgrade any port  
foo that you indicate. And "sudo port upgrade outdated" might even  
upgrade all your outdated ports for you all at once. (I usually do it  
one at a time though.)

Before you do any of this, please ensure that you have Xcode 2.4.1 or  
2.5 installed. Get Info on /Developer/Applications/Xcode to see what  
version you have. Download a newer Xcode from http:// if necessary. Earlier versions of Xcode often  
cause problems.

More information about the macports-users mailing list