FreeBSD Ports Collection

1) http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html

The BSD Ports collection is a great tool for application management, usage is as below:

Updating/Installing the Ports collection:

Assuming BSD >= 6.1 RELEASE – for older versions see reference 1 above

Using portsnap for the first time:

cd /usr/ports portsnap fetch portsnap extract

Updating an existing ports collection:

cd /usr/ports portsnap update

Browsing the ports collection:

Browsing the ports collection is really simple and straightforward – cd directory of course changes your current directory and ls displays a list of a directory’s contents. The ports collection is based in /usr/ports – the example below is for navigating to KDevelop (giving full directory listings in the process as you would typically do while browsing for a port to install. | less and q (used to escape less) can be omitted if you have enough screen realestate):

cd /usr/ports ls | less q cd devel ls | less q cd kdevelop

Building/Installing/Uninstalling/Reinstalling/Cleaning a port:

Assuming you have already navigated to the directory of the desired port in /usr/ports

To build a port (sometimes preferred if there is a risk of a failure or if you aren’t too lazy to add the extra word after it in a separate command):

make

To install a port:

make install

To remove a port:

make deinstall

To reinstall a port:

make reinstall

To clean a distfile directory (good to do if you care about disk space and almost always required before doing a reinstall):

make clean

Simple eh? Ports are by far my most liked feature contained in BSD aside from security 🙂

One thing worth noting is that there are more advanced features with ports, which are better documented in reference 1 above (this page is meant to be a quick reference only) – however this should work if your just installing to default directories from a host machine or within a jail via ssh.

Comments are closed.