Keep in mind that installing software via the FreeBSD ports tree results in the installation of a package, but not necessarily the creation of a package that can be moved among systems. That is why administrators can install software with the ports tree and then use the FreeBSD pkg_info, pkg_delete, and other pkg tools to manipulated deployed applications.
The first tool is gpkgdep, in the ports tree as sysutils/gpkgdep, by Jack Slater. This is an older tool but it works fine on my FreeBSD 5.2.1 REL system. Gpkgdep has good online documentation, but I'll quickly describe its use via a few screenshots.
This screen shot shows the "Required Packages" tab. It shows all installed packages, not all of the packages which could be installed. (This differs from a tool like sysutils/pib, a Tcl/Tk tool which presents information found in the ports index.) At the top of the screen shot we see "nmap-3.5.0", with "pcre-4.5" indented below. This means pcre is a dependency of nmap, i.e., nmap needs pcre to run. If we wanted to remove pcre, it would prevent us from running nmap. Further down the list we see "p0f-2.0.3_1", which has no arrow to the left of its name nor anything listed below. This means p0f has no dependencies.
The next screen shot shows the "Dependent Packages" tab. This lists packages followed by their dependencies. In this view, we're looking at "pcre-4.5" at the top. Indented below it we see "ethereal-0.10.3" and "nmap-3.50". This means both ethereal and nmap depend upon pcre.
The final screen shot displays the "Remove Package Simulation." Here we can select packages and see their dependencies selected automatically. Here we see "ethereal-0.10-3" selected, and gpkgdep has dynamically selected Ethereal's dependencies. They are show with slightly greyed-out boxes.
Turning to the command line environment we have sysutils/pkg_tree by Edwin Groothuis. This tool provides similar information in CLI form. To see Ethereal's dependencies, try this:
$ pkg_tree ethereal
This shows all of the packages needed by Ethereal and also Tethereal. Nmap is simpler:
$ pkg_tree nmap
If you want to see all of the dependencies for the listed packages, use the -v option:
$ pkg_tree -v ethereal
| \__ perl-5.6.1_15
| |\__ libiconv-1.9.1_3
| \__ expat-1.95.7
| |\__ python-2.3.4
| |\__ pkgconfig-0.15.0_1
| \__ libiconv-1.9.1_3
If you run this tool without any options, it queries the package database for every installed application.
Keep these tools in mind when you feel like doing some package house cleaning.