FreeBSD installing packages

lost May 22, 2010 Computers
This is a brief overview on how to intstall packages in FreeBSD

About the tutorial

This is NOT and in depth tutorial to explain every single aspect of the commands and environments. It is a quick and dirty giving you the background and how to get up and running.

Quick background check

Source vs Binary

Just to be clear and keep it simple, source is human readable text explaining to the computer what the application does. Binary is when the source has been compiled (made so the computer can read it and not human readable. It like a cake... source is all the ingredients and you can still make changes before you bake (compile) it. Or you can buy an already baked cake (binary) where you cant make changes to it.

Packages vs Ports

Ports are source, packages are binary. Sometimes you need the source as you need to compile it with certain parameters. Take php for example, you need to tell php to be complied with MySQL support. If you where to just install the binary its already compiled without MySQL support. 

Getting dirty


The ports tree in FreeBSD fetches a list of available software for FreeBSD and is well structured to find what you are looking for. You must be root to install ports. The path for ports is:


Example to get to lighttpd:


 My personal port install method is as follow:

# cd /usr/ports/category/application ; make config ; make install clean ; rehash ; cd -

Ok, to break that down:

cd /usr/ports/category/application

Go to the directory


Do this command next, as you will notice it splits all the command to create a semi automated process

make config

If there are additional options to configure, bring up the screen and make your selection(s)

make install clean

Start with the compiling of the application and after successful complation remove the source files from the PC.


Unlike many Linux distro's FreeBSD must be told to refresh its application directories, else it will only be available  one you logout and login again

cd -

Return back to the current path where you are now.


Packages are far more simple to instal.

pkg_add -r application

This will fetch the application from the server it resides on and install it. Nice and easy.

I prefer to pkg_add applications such as firefox and thunderbird. It is just rediculous to site through a 30 source to compile and I need none of those other fancy things extra


And thats the sweet and the short of it,  hope this helps


What did you think of this tutorial?
0 CommentsAdd a Comment