Installing packages using ports in FreeBSD

Suppose you want to install package lsof

# cd /usr/ports/sysutils/lsof 

Once inside the lsof directory, you need to compile, or “build”, the port. This is done by simply typing make at the prompt. Once you have done so, you should see something like this:

# make
[extraction output snipped]
>> Checksum OK for lsof_4.57D.freebsd.tar.gz.
===> Patching for lsof-4.57
===> Applying FreeBSD patches for lsof-4.57
===> Configuring for lsof-4.57
[configure output snipped]
===> Building for lsof-4.57
[compilation output snipped]

The next step is to install the port. In order to install it, you simply fire the make command

# make install
===> Installing for lsof-4.57
[installation output snipped]
===> Generating temporary packing list
===> Compressing manual pages for lsof-4.57
===> Registering installation for lsof-4.57
This port has installed the following binaries
which execute with increased privileges.

You are done :)