Ports and Dependencies in FreeBSD

I have been trying to determine what ports or packages are dependencies of other ports or packages in FreeBSD. I searched around the Web and came up with two scenarios and one I stumbled upon while searching around /usr/ports.

The first solution I found was to use the pretty-print-run-depends-list target for the make command. The man page for ports explains this target (and pretty-print-build-depends-list) as follows:

Print a list of all the compile and run dependencies, and dependencies of those dependencies.

Below is an example using this scenario for the FreeBSD port of nmap.

# cd /usr/ports/security/nmap/
# make pretty-print-run-depends-list
This port requires package(s) "gettext-0.14.5_2 gmake-3.80_2 libiconv-1.9.2_2 pcre-6.6_1" to run.

Another solution I ran across was to use the search target of the make command. Below is an example:

# cd /usr/ports && make search name=nmap
Port: nmap-4.01_1
Path: /usr/ports/security/nmap
Info: Port scanning utility for large networks
Maint: daniel@roe.ch
B-deps: gettext-0.14.5_2 gmake-3.80_2 libiconv-1.9.2_2 pcre-6.6_1
R-deps: pcre-6.6_1
WWW: http://www.insecure.org/nmap/

In the above example, more data was returned but not related to what we were looking for. The search target will return information on any ports that contain the string “nmap” (for this example), like openmap, nmapfe, and p5-Nmap-Scanner, but we were only interested in the actual nmap port itself and it’s build and run-time dependencies.

The solution I came across while perusing the ports tree is a utility called pkg_tree. It is located in, and can be installed from /usr/ports/sysutils/pkg_tree. Below is how I installed the tool and used it to find the run-time dependencies of nmap.

# cd /usr/ports/sysutils/pkg_tree && make install clean
# rehash
# pkg_tree nmap
nmap-4.01
\__ pcre-6.6 (unknown)

So, the next time you’re working with your ports and packages and need to determine what packages depend on others, hopefully one of these three options will get you the information you need. Until next time…

WordPress database error: [Table 'wp_comments' is marked as crashed and should be repaired]
SELECT * FROM wp_comments WHERE comment_post_ID = '51' AND comment_approved = '1' ORDER BY comment_date

Leave a Reply