Home arrow Guides arrow Quick Guide to FreeBSD Ports
Quick Guide to FreeBSD Ports PDF
Monday, 13 February 2012
FreeBSD Ports

FreeBSD Ports and Packages system
is a powerfull tool to manage userland apps under FreeBSD.

To learn more about how to manage FreeBSD packages, read this article: http://www.freebsdonline.com/content/view/469/485/

To install apps from FreeBSD ports, First you must first get the ports tree. To learn how to get FreeBSD ports tree read this article: http://www.freebsdonline.com/content/view/460/476/

So here we go.

Find where a port is located

Let's say we want to install Apache web server. We will find where is located in ports with whereis command:

  whereis apache22

the output would be:

  apache22: /usr/ports/www/apache22

Installing a port

To install a port we go to the directory where the port is located and we run make install command:

  cd /usr/ports/www/apache22
  make install

Cleaning a port

Cleaning a port means to delete object files resulted from compilation of the port:

  make clean

Install and then clean a port

  make install clean

Install and clean the source file archive of a port

When we run make command it will download the source archive of the port first and it will copy it in /usr/ports/distfiles. If we want to clean the source archive file from that directory we run:

  make distclean

Configure port options

You will notice some ports have a menu for configuring features that will be added to the app at compilation time. After you make a choice, next time you will try to compile that menu will not appear. To make that menu appear and choose between some of  the options of the port, run:

  make config

Note: not all apps have such menu. Some of them have no options to configure.

Remove user configured options

There's an option to remove previously configured options and reset to default options with command:

  make rmconfig

Install without going to the options menu

Sometimes you just want to compile default options of a port and of all dependencies of that port. In case you want to do that, use -DBATCH option:

  make -DBATCH install clean

Dealing with errors

Sometimes you want to build a port that has lots of dependencies and some of them has an old version compiled (before our last cvsup) that will break our new building process. So if you have such error just delete work directory of all ports:

  rm -r /usr/ports/*/*/work

You can also run:

  make clean-depends


  make clean-recursive
Note: When dealing with FreeBSD Ports read /usr/ports/UPDATING files, so you could know if there are issues when updating FreeBSD Ports.

Last Updated ( Thursday, 22 March 2012 )
< Prev   Next >

Other BSD Systems





Best BSD firewall?