Skip to main content.

Building a FreeBSD desktop


Live demo in BSD Now Episode 010 | Originally written by TJ for | Last updated: 2015/02/12

NOTE: the author/maintainer of the tutorial(s) is no longer with the show, so the information below may be outdated or incorrect.

While the BSD family of operating systems are known around the world for their stability, scalability, performance and security in the server space, they can actually make a pretty nice desktop as well. The PC-BSD project aims to provide an out-of-the-box BSD desktop system. If you're not comfortable configuring things by yourself, it's recommended that you use PC-BSD. For the rest of us who like doing things our own way, this guide will show you how to go from nothing to a FreeBSD desktop system. The only thing you need to do before reading this tutorial is have a FreeBSD CD, DVD or USB drive created. Let's boot up from the disk and get going! Hit enter and let's start answering some questions. Most of them should be pretty obvious and straightforward. Be sure to add your user to the "wheel" group when creating it. Once you've gone through the install, reboot and login as root on your new system.

The first thing you need to do is check that your network is up and running. ping is a good way to test if DNS and connectivity are both in good standing.

# ping -c 2

PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=50 time=45.800 ms
64 bytes from icmp_seq=1 ttl=50 time=43.682 ms

--- ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 43.682/44.741/45.800/1.059 ms

Keeping a system up to date is a very important part of running any OS. That's what I like to do first upon a new installation.

# freebsd-update fetch install

Looking up mirrors... 5 mirrors found.
Fetching public key from done.
Fetching metadata signature for 9.3-RELEASE from done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.
Preparing to download files... done.
Fetching 88 patches.....10....20....30....40....50....60....70....80.... done.
Applying patches...
Installing updates... done.

We'll put a basic firewall configuration in place.

# vi /etc/pf.conf

Something like:

ext_if = "em0"
set block-policy drop
set skip on lo0
scrub in all no-df random-id
block in all
antispoof quick for ($ext_if)
block in quick from { urpf-failed no-route } to any
pass out quick on $ext_if keep state 

Replace "em0" with the name of your network interface. Now, let's install some things we'll need. If you want to use pkgng and binary packages, feel free to do so. I'm going to be using ports instead, so skip over the next few parts if you are going binary-only. Let's extract the ports collection and edit a couple configuration files for it.

# portsnap fetch extract

Looking up mirrors... 7 mirrors found.
Fetching public key from done.
Fetching snapshot tag from done.
Fetching snapshot metadata... done.
Fetching snapshot generated at Fri Aug 23 20:04:55 EDT 2013:
e1395518b91e1e2e3921ae45f57f09b656fb9adeb509c5  7% of   69 MB 1843 kBps

It will then extract the whole ports tree to /usr/ports. This may take a bit of time depending on your CPU, disk and network speeds. Before we actually start compiling things, I'd like to make some customizations to our /etc/make.conf file. It controls what options ports are built with.

# vi /etc/make.conf

This is mine. You can adopt it to your needs and how you want your system to be.


The clang-related and pkgng lines are only needed for FreeBSD 9.x and older. The first tool I always install is portmaster. It makes installing and upgrading ports a lot easier.

# cd /usr/ports/ports-mgmt/portmaster
# make install clean

Now we can start building all the software we'll need. My goal is a simple desktop with XFCE, Firefox for browsing and some other small things. You can change XFCE to your window manager or desktop environment of choice. My laptop has an older Intel GMA graphics chip, so I'll get the driver for that. If you have an nVidia card or newer Intel GPU, consult the FreeBSD handbook's nVidia page and Intel GPU wiki for information about what you need. I'm going to include some other utilities that I like having around. You can always add and remove ports, but it's easiest to just get everything you need at once. If you want Adobe Flash in your web browser, you need to install the Linux emulation layer. Although I don't want that stuff on my systems, I'm including it in the tutorial. The ports you install are your choice. Some other popular choices for a GUI would include: x11/gnome2, x11/kde4, x11-wm/i3, x11-wm/openbox, x11-wm/fluxbox, etc.

# portmaster -d --no-confirm x11-wm/xfce4 www/firefox x11/xorg x11/xinit x11/rxvt-unicode \ 
x11-drivers/xf86-video-intel sysutils/tmux x11-fonts/webfonts \
shells/bash editors/vim games/cowsay x11/dmenu graphics/feh sysutils/hal irc/irssi  \
x11/lxappearance multimedia/mplayer mail/mutt www/nspluginwrapper www/linux-f10-flashplugin11 \
x11-fm/pcmanfm net-p2p/rtorrent security/sudo x11-fonts/ubuntu-font x11-themes/gtk-murrine-engine \
sysutils/screenfetch x11/xdm misc/xfce4-wm-themes security/tor net/openntpd

Hit enter and portmaster will present you with configuration options for all the ports you're installing. If you don't know what to choose then just leave the defaults. I like to take out everything I'm not going to use. Once they've compiled, we add the Linux emulation module and HAL to start at boot. Since we're going to reboot anyway, we'll also add a couple other things to /etc/rc.conf, /etc/periodic.conf, /etc/devfs.rules and /etc/sysctl.conf. There are man pages for each of those configuration files if you're not familiar with them.

In /boot/loader.conf, add:


In /etc/rc.conf, add:


We want to be able to mount and unmount drives as a regular user. In /etc/devfs.rules, add:

add path 'da*' mode 0660 group wheel
add path 'md*' mode 0660 group wheel
add path 'ada*' mode 0660 group wheel

In /etc/sysctl.conf, add:


In /etc/periodic.conf, add:


Add linprocfs:

# echo "linprocfs   /compat/linux/proc   linprocfs   rw   0  0" >> /etc/fstab
# reboot

After you log in, you should now have a functioning desktop with default settings, depending on what window manager and/or desktop environment you chose. If you chose to install Flash and the emulation stuff, get it working properly by issuing the following commands:

# ln -s /usr/local/lib/npapi/linux-f10-flashplugin/ /usr/local/lib/browser_plugins/
$ nspluginwrapper -v -a -i

When you update Flash, run:

$ nspluginwrapper -v -a -u

You can install the PCBSD shell and GUI utilities to make some tasks like connecting to WiFi and managing disks easier. I recommend gnome-look, box-look or kde-look for downloading new themes. Of course, how to configure your graphical environment depends entirely on what window manager you use. I can't write a tutorial for each of them, but Google has lots of walkthroughs and tips for various environments. FreeBSD, as well as most other Unix-like systems, can be configured in countless different ways. It all depends on you personal preferences. I hope this guide was helpful as a starting point in getting your desktop system just how you like it. Here's how mine ended up:

Latest News

New announcement


We understand that Michael Dexter, Brad Davis, and George Rosamond think there should be more real news....

Two Year Anniversary


We're quickly approaching our two-year anniversary, which will be on episode 105. To celebrate, we've created a unique t-shirt design, available for purchase until the end of August. Shirts will be shipped out around September 1st. Most of the proceeds will support the show, and specifically allow us to buy...

New discussion segment


We're thinking about adding a new segment to the show where we discuss a topic that the listeners suggest. It's meant to be informative like a tutorial, but more of a "free discussion" format. If you have any subjects you want us to explore, or even just a good name...

How did you get into BSD?


We've got a fun idea for the holidays this year: just like we ask during the interviews, we want to hear how all the viewers and listeners first got into BSD. Email us your story, either written or a video version, and we'll read and play some of them for...

Episode 251: Crypto HAMMER


Direct Download:MP3 AudioVideo This episode was brought to you by Headlines DragonflyBSD: Towards a HAMMER1 master/slave encrypted setup with LUKS I just wanted to share my experience with setting up DragonFly master/slave HAMMER1 PFS's on top of LUKS So after a long time using an Synology for my NFS needs, I...

Episode 250: BSDCan 2018 recap


Direct Download:MP3 AudioVideo This episode was brought to you by Headlines TrueOS to Focus on Core Operating System The TrueOS Project has some big plans in the works, and we want to take a minute and share them with you. Many have come to know TrueOS as the “graphical FreeBSD” that makes...

Episode 249: Router on a stick


Direct Download:MP3 AudioVideo This episode was brought to you by Headlines ZFS and DTrace update lands in NetBSD merge a new version of the CDDL dtrace and ZFS code. This changes the upstream vendor from OpenSolaris to FreeBSD, and this version is based on FreeBSD svn r315983. + r315983 is from...

Episode 248: Show me the Mooney


Direct Download:MP3 AudioVideo This episode was brought to you by Headlines DragonFlyBSD: release52 (w/stable HAMMER2, as default root) DragonflyBSD 5.2.1 was released on May 21, 2018 > Big Ticket items: > Meltdown and Spectre mitigation support Meltdown isolation and spectre mitigation support added. Meltdown mitigation is automatically enabled for all Intel cpus. Spectre mitigation must be enabled...