How to do a clean reinstall with macports?

Jack Twain picture Jack Twain · Mar 7, 2014 · Viewed 8.1k times · Source

How can one do a complete clean reinstall of a port and at the same time a complete clean reinstall of all its dependenceis?

Answer

Marc picture Marc · Jan 5, 2015

From the MacPorts wiki (migration):

https://trac.macports.org/wiki/Migration

After having saved a list of installed ports using:

port -qv installed > myports.txt

and having removed them with:

sudo port -f uninstall installed

Download and execute the restore_ports script. (If you installed MacPorts from source and used a custom prefix, then you'll need to use the -p option when you run restore_ports.tcl; see ./restore_ports.tcl -h.)

curl -O https://svn.macports.org/repository/macports/contrib/restore_ports/restore_ports.tcl
chmod +x restore_ports.tcl
sudo ./restore_ports.tcl myports.txt