How can one do a complete clean reinstall of a port and at the same time a complete clean reinstall of all its dependenceis?
Uninstall All Ports If you want to uninstall MacPorts and the port command is functioning, first uninstall all the installed ports by running this command in the Terminal: All that will be left in your installation prefix now will be files that were not registered to any port.
By default, upgrading ports in MacPorts does not remove the older versions. This is a safety measure to ensure you can go back to a working and tested version in case an update goes wrong. To save disk space, you should periodically uninstall any old versions you no longer need. Use to get a list of inactive ports you likely no longer need.
The 'macportsfoster' script will output a list of all ports not required by anything in the requested-list, ordered such that 'port deactivate $ (macportsfoster)' will remove all of them in one shot. I think the other answers, and the --follow-dependents flag, do not do what you want.
If you are using macOS, you should install MacPorts using the macOS package installer unless you do not wish to install it to /opt/local/, the default MacPorts location, or if you wish to install a pre-release version of MacPorts base.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With