5.7. Desktop Environments

Contributed by Valentino Vaschetto.

This section describes how to install three popular desktop environments on a FreeBSD system. A desktop environment can range from a simple window manager to a complete suite of desktop applications. Over a hundred desktop environments are available in the x11-wm category of the Ports Collection.

5.7.1. GNOME

GNOME is a user-friendly desktop environment. It includes a panel for starting applications and displaying status, a desktop, a set of tools and applications, and a set of conventions that make it easy for applications to cooperate and be consistent with each other. More information regarding GNOME on FreeBSD can be found at https://www.FreeBSD.org/gnome. That web site contains additional documentation about installing, configuring, and managing GNOME on FreeBSD.

This desktop environment can be installed from a package:

# pkg install gnome3

To instead build GNOME from ports, use the following command. GNOME is a large application and will take some time to compile, even on a fast computer.

# cd /usr/ports/x11/gnome3
# make install clean

GNOME requires /proc to be mounted. Add this line to /etc/fstab to mount this file system automatically during system startup:

proc           /proc       procfs  rw  0   0

GNOME uses D-Bus and HAL for a message bus and hardware abstraction. These applications are automatically installed as dependencies of GNOME. Enable them in /etc/rc.conf so they will be started when the system boots:

dbus_enable="YES"
hald_enable="YES"

After installation, configure Xorg to start GNOME. The easiest way to do this is to enable the GNOME Display Manager, GDM, which is installed as part of the GNOME package or port. It can be enabled by adding this line to /etc/rc.conf:

gdm_enable="YES"

It is often desirable to also start all GNOME services. To achieve this, add a second line to /etc/rc.conf:

gnome_enable="YES"

GDM will start automatically when the system boots.

A second method for starting GNOME is to type startx from the command-line after configuring ~/.xinitrc. If this file already exists, replace the line that starts the current window manager with one that starts /usr/local/bin/gnome-session. If this file does not exist, create it with this command:

% echo "exec /usr/local/bin/gnome-session" > ~/.xinitrc

A third method is to use XDM as the display manager. In this case, create an executable ~/.xsession:

% echo "exec /usr/local/bin/gnome-session" > ~/.xsession

5.7.2. KDE

KDE is another easy-to-use desktop environment. This desktop provides a suite of applications with a consistent look and feel, a standardized menu and toolbars, keybindings, color-schemes, internationalization, and a centralized, dialog-driven desktop configuration. More information on KDE can be found at http://www.kde.org/. For FreeBSD-specific information, consult http://freebsd.kde.org.

To install the KDE package, type:

# pkg install x11/kde5

To instead build the KDE port, use the following command. Installing the port will provide a menu for selecting which components to install. KDE is a large application and will take some time to compile, even on a fast computer.

# cd /usr/ports/x11/kde5
# make install clean

KDE requires /proc to be mounted. Add this line to /etc/fstab to mount this file system automatically during system startup:

proc           /proc       procfs  rw  0   0

KDE uses D-Bus and HAL for a message bus and hardware abstraction. These applications are automatically installed as dependencies of KDE. Enable them in /etc/rc.conf so they will be started when the system boots:

dbus_enable="YES"
hald_enable="YES"

Since KDE Plasma 5, the KDE Display Manager, KDM is no longer developed. A possible replacement is SDDM. To install it, type:

# pkg install x11/sddm

Add this line to /etc/rc.conf:

sddm_enable="YES"

A second method for launching KDE Plasma is to type startx from the command line. For this to work, the following line is needed in ~/.xinitrc:

exec ck-launch-session startplasma-x11

A third method for starting KDE Plasma is through XDM. To do so, create an executable ~/.xsession as follows:

% echo "exec ck-launch-session startplasma-x11" > ~/.xsession

Once KDE Plasma is started, refer to its built-in help system for more information on how to use its various menus and applications.

5.7.3. Xfce

Xfce is a desktop environment based on the GTK+ toolkit used by GNOME. However, it is more lightweight and provides a simple, efficient, easy-to-use desktop. It is fully configurable, has a main panel with menus, applets, and application launchers, provides a file manager and sound manager, and is themeable. Since it is fast, light, and efficient, it is ideal for older or slower machines with memory limitations. More information on Xfce can be found at http://www.xfce.org.

To install the Xfce package:

# pkg install xfce

Alternatively, to build the port:

# cd /usr/ports/x11-wm/xfce4
# make install clean

Xfce uses D-Bus for a message bus. This application is automatically installed as dependency of Xfce. Enable it in /etc/rc.conf so it will be started when the system boots:

dbus_enable="YES"

Unlike GNOME or KDE, Xfce does not provide its own login manager. In order to start Xfce from the command line by typing startx, first create ~/.xinitrc with this command:

% echo ". /usr/local/etc/xdg/xfce4/xinitrc" > ~/.xinitrc

An alternate method is to use XDM. To configure this method, create an executable ~/.xsession:

% echo ". /usr/local/etc/xdg/xfce4/xinitrc" > ~/.xsession

All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.