Note: A couple of years back, I used to run OSX on my hacking machine. OSX proved to be a very capable environment, with a nice graphical interface combined with the hackability of a *nix-like underlying operating system. At the moment, I don't have an OSX computer,, but I will keep these nuggets left in place if they help someone.
MacPort commands
port echo leaves
Some common leaves (automake, gperf, libtool, pkgconfig) are build-time dependencies of common ports, so you may want to “request” them (sudo port setrequested port1 port2 port3 …) to avoid uninstalling them just to have to reinstall them later.
You can uninstall any remaining leaves quite easily:
sudo port uninstall leaves
Note: Before pruning your leaves, you may also want to uninstall old versions of ports that are no longer “active”. This may reveal a few more leaves (i.e. ports that are dependencies of ports that are installed, but inactive):
sudo port uninstall inactive
sudo port setrequested autoconf automake gccmakedep getopt imake libmcrypt intltool lzo openssh pkgconfig