Cleaning Up and Removing Unused Ports in Your MacPorts

To remove inactive ports:

sudo port uninstall inactive

To remove downloaded distfiles with:

sudo port clean --all installed

To remove orphaned (not referenced and not anymore used ports) you can use an external tool port_cutleaves

First install the tool using MacPorts

sudo port install port_cutleaves

Then run it

sudo port_cutleaves