Remove all ports

Anders F Björklund afb at
Thu Sep 13 23:18:02 PDT 2007

Bill Hernandez:

> I don't know if you've installed anything other than MacPorts in /opt 
> but if you have not, you could probably delete everything in the /opt 
> directory.
> I would first backup anything you might need. You WILL want to backup 
> things like http.conf, my.cnf, php.ini, any other configuration files, 
> any databases, etc. If you any MySQL databases you can use the shell 
> script below bh_mysql_backup
> I don't keep any of the configs within the /opt directory, because 
> that way I can delete the entire thing, re-install the ports, 
> initialize and set the permissions for the databases (MySQL and 
> PostgreSQL), create some soft links to the configuration files, and 
> everything works very well.

The default MacPorts prefix is *not* /opt, it is "/opt/local".

If you delete the entire /opt, you risk throwing away other
third-party software that (rightfully) gets installed there...
(nothing by Apple though, in a clean Mac OS X / Xcode install)
Both of /usr/local and /opt are traditional install locations.

So while removing /opt also "works", it's safer using /opt/local.


More information about the macports-users mailing list