Dia

Ryan Schmidt ryandesign at macports.org
Mon Sep 20 12:42:27 PDT 2010


On Sep 20, 2010, at 06:34, Z wrote:

> These remarks are totally insightful. In fact, my machine did experience lots of problems with its Mac OS. The reason might be my installation of several versions of "Ocaml". 
> 
> So I would like to follow your advice, to uninstall MacPorts and all ports. It seems that it is quite an impressing step, according to the mac port guide. 
> 
> I wonder whether should I take close attention to something special before the uninstallation of that many ports and Macport itself? 

Please ignore John Brown's reply.

Through whatever means, files appear to have been written into the MacPorts prefix (/opt/local) that are not registered to MacPorts. One common way that this happens is if you used a binary installer that someone has produced using a MacPorts installation with the prefix set to /opt/local. People aren't supposed to distribute binaries like this, but some people don't know that. (Developers wishing to distribute binaries produced with MacPorts should install their MacPorts in a prefix that is not /opt/local, so as not to conflict with users who also use MacPorts for other things.) I have downloaded the ocaml-3.12.0-intel.dmg installer from the Ocaml web site and its readme says it installs into /usr/local, not /opt/local. Ocaml also doesn't depend on any of the software that you've been having trouble with (glib2, xorg-libXext). So Ocaml should not be the culprit. If there are any other disk image installers that you downloaded from web sites, let us know and we could investigate those as well.


Having things installed in /usr/local is also a problem for MacPorts, though of a different kind: Software built using MacPorts, or by hand, will often find and use software in /usr/local, though we don't want it to, and we don't have a general-purpose way for MacPorts to ensure this doesn't happen. So before reinstalling MacPorts, you should also remove (or move aside) /usr/local (for example, rename it to /usr/local-off).


You're right that uninstalling and reinstalling MacPorts is a drastic step, but it's the only way I can think of at the moment to ensure that all the files in your MacPorts prefix were actually put there by MacPorts and are of the correct versions, since under normal circumstances the errors you've encountered should not have been possible. You may be able to automate the process of reinstalling your ports using the restore_ports.tcl script shown here:

http://trac.macports.org/wiki/Migration#automatic

That wiki page is written for people who have upgraded from Leopard to Snow Leopard; when changing the major Mac OS X version, users must also uninstall and reinstall all ports, so although that's not the cause of the problem in your case, the solution is the same.

I suggest you follow the first three steps shown on that page:

> 1. Save the list of installed ports:
> 
> port installed > myports.txt
> 
> 2. Uninstall all installed ports:
> 
> sudo port -f uninstall installed
> 
> 3. Clean any partially-completed builds and remove any archives:
> 
> sudo port clean --work --archive all

At that point, /opt/local should only contain:

1. the MacPorts base software -- things like /opt/local/bin/port and /opt/local/bin/daemondo; this will be reinstalled when you reinstall MacPorts.

2. distfiles in /opt/local/var/macports/distfiles; you may want to save this directory and move it back into place after reinstalling MacPorts to save on download time. There is no danger that MacPorts would use an outdated or corrupted file because MacPorts verifies the checksums of each file before use.

3. configuration files, databases, or other data you've created that should be preserved. Configuration files are usually in /opt/local/etc, but individual ports may vary; for example, apache2's configuration files are instead in /opt/local/apache2/conf. Databases might be in /opt/local/var/db. Other data might include web sites you've created in /opt/local/www. 

4. unproblematic leftover files from uninstalled ports (for example fontconfig leaves cache files in /opt/local/var/cache/fontconfig)

5. files that don't belong there that have been causing the problems you've been having

You should spend a little time going through the files remaining in /opt/local to figure out which of them fall into category 3 -- files you'd want to keep. In fact, to ensure you don't miss any, just rename /opt/local to /opt/local-old. If you later notice you're missing some data you created or a configuration file you modified, you can get it from /opt/local-old. And eventually, once you're sure you have everything you need, /opt/local-old can be removed.

Now that /opt/local is gone, you can reinstall MacPorts base. Since you're using Leopard, download the MacPorts 1.9.1 disk image for Leopard from http://www.macports.org/install.php and install it.

Now you may want to remove the empty directory /opt/local/var/macports/distfiles (if it exists) and replace it with the directory from /opt/local-old/var/macports/distfiles to save download time when reinstalling ports, as discussed above.

Before reinstalling any ports, verify /usr/local is gone or renamed, and take a moment to edit the MacPorts configuration files macports.conf, variants.conf and sources.conf as desired.

Then, you can use the restore_ports.tcl script to reinstall the ports you had installed before. Or you can just manually reinstall the ports you know you want ("sudo port install dia", etc.)

And finally, bring over any configuration files or data you know you need from /opt/local-old.


I hope that's clear but I realize it my reply was very long. Please let me know if I've left anything out or if you have questions.




More information about the macports-users mailing list