How to install OpenBSD packages directly from an FTP server

You want to install OpenBSD additional packages such as bash, pico, mozilla-firefox and others directly from an ftp server meaning that you do not need to download the packages first and save to your hard disk. In other word, installing the packages on the fly.

It is very easy to do this. We will do this using ‘pkg_add’ tool. One thing you need to know is ‘pkg_add’ will try to search the packages name in the working directory where you type the pkg_add command and also search the dependency of packages that you want to install. If it could not be found, error messages will be prompted.

To force the pkg_add default search to a specific directory or an ftp server, you have to set PKG_PATH value on your current shell. In this case we will set it to an ftp server nearest to you. Since I live in Indonesia I use as my PKG_PATH. For the full list of available FTP servers can be found at

In your terminal, run this command below:

$ export PKG_PATH=`machine -a`/

Make sure the above command works properly by echoing the command below:

bash-3.2$ echo $PKG_PATH

From now you are ready to install OpenBSD packages directly from the ftp server. Try to install some software like bash, pico, wget or others.

bash-3.2$ sudo pkg_add wget
wget-1.11.4: complete

To make PKG_PATH permanently set on your system, edit .profile file in your home directory to be something like this:

# $OpenBSD: dot.profile,v 1.4 2005/02/16 06:56:57 matthieu Exp $
# sh/ksh initialization

PKG_PATH=`machine -a`/

Wish this tutorial useful for you. Happy using OpenBSD :)