Minimal Xorg installation with dwm on FreeBSD

This method may be actual on weak computers for resource economy. The installation process is fast and requires only dwm compilation. Excluded an installation of huge font packages, classical xorg utilities (like xterm). There are no any visual settings for configs, additional fonts, drivers. Only the minimal process is described here.

First we need to install dbus. This service may be needed in the xorg environment for the correct work of some applications (GTK, QT), for example, many browsers use it (like firefox). Even many media players use this service (like VLC), so it is recommended to install it:

sudo pkg install dbus

Then, we need to set this service to start automatically with FreeBSD. Open rc.conf file:

sudo nano /etc/rc.conf

And write the following line in it:


In FreeBSD documentation it is recommended to also install HAL service and enable it with hald_enable=”YES”, but in present time Xorg refused to use it and doesn’t require it anymore. Only some old GNOME, KDE applications still use it. Therefore, HAL is not required to install, we can skip this step.

Now when dbus has been installed, we need to reboot the system for the service to start working:

sudo shutdown -r now

Now we can proceed to install xorg. There is a minimal package called xorg-minimal it contains everything we need (xorg-server itself, vesa, keyboard, mouse drivers). But some libraries are missing to make dwm build correctly (and many other window managers like i3wm, bspwm, openbox, Xfwm for XFCE, KWin for KDE). It is Xft (API for X applications that select fonts and render them) and Xinerama (multi display support that is required for dwm compilation as a dependency):

sudo pkg install xorg-minimal libXft libXinerama

Then we need fonts for Xorg and dwm, otherwise we can install xorg-fonts package that is huge and includes 40+ fonts-dependencies.

I found that dejavu package has all the necessary fonts for a minimal installation. It includes Monospace font that dwm is used by default:

sudo pkg install dejavu

When the installation is complete, we may receive a warning that tells to load font X module. We don’t need to do this, because at present, Xorg is able to do it automatically. Also, Xorg is configured automatically, so its configuration now needs to be done in rare cases, for example, with proprietary NVIDIA video card drivers, if it doesn’t happen automatically.

Now we need to install some terminal emulator, so that we can execute commands under X. It is also recommended to install dmenu to quickly launch applications by their name with Alt+P shortcut (by default):

sudo pkg install sterm dmenu

It’s time to build dwm from source codes. When the build configuration appears, uncheck “install dmenu and sterm” as we have already done it above:

cd /usr/ports/x11-wm/dwm
sudo make install clean
Build configuration menu of dwm
Uncheck DMENUANDSTERM because we already have installed these utilities

I already have articles about How to install FreeBSD ports using svnlite and How to download and modify sources via ports on dwm example.

There is also an article about How to make dwm look better.

Back to home directory. Create a file with Xorg launch parameters:

cd ~
nano .xinitrc

Write to the file to run dwm when Xorg starts:

exec dwm

Start X server with startx command:


Press Shift + Alt + [Enter] to open sterm (terminal emulator that we have installed). Make neofetch. I already have an article about How to install neofetch with bash in FreeBSD:

Neofetch in FreeBSD under X with dwm
Neofetch in sterm with dwm. In total, I got 72 packages in the system. This is really a very small amount

It is possible to install a modern internet browser, for example firefox:

sudo pkg install firefox
Firefox in FreeBSD with dwm
Firefox with minimal Xorg installation with 1 font package installed

As we can see, this is a fast way to install a minimal set of packages in just 5 minutes. Without extra compilations, without removing anything from the system. If we need any package, we can always install it. We can install additional programs, fonts and drivers from this minimal system.