Xorg and Desktop Environments


MidnightBSD uses Xorg to display graphical applications. Users will need to select an available desktop environment to use. Choices include Xfce, Gnome 3, WindowMaker + GNUStep as well as a few lightweight options.


firstboot script

When you first install MidnightBSD, a script called firstboot which lives in /etc/rc.d/firstboot will ask if you would like to install a graphical desktop environment. This will allow you to select xfce or WindowMaker. If you would like to run this script again, you can delete /etc/fbreciept and then run it with service firstboot start or /etc/rc.d/firstboot start

The remaining options in this page cover manual installation for various desktop environments.


To install the X-Windows environment from packages, simply run mport install xorg. If you wish to build the software manually, you may do so from mports cd /usr/mports/x11/xorg; make install clean

You may then start Xorg by running startx from the console. If you are using tcsh, you may need to first run rehash before startx will be picked up.

In order to exit Xorg, you can enable the control + alt + backspace keyboard sequence by running this in an xterm window within Xorg. setxkbmap -option terminate:ctrl_alt_bksp

Grapical login manager

There are several graphical login managers that can be used instead of running startx manually.

The default login manager as of MidnightBSD 2.1 is mlogind. This is based on slim.

You can install it with mport install mlogind or cd /usr/mports/x11/mlogind && make install clean

You can install xdm from packages or mports with mport install xdm or cd /usr/mports/x11/xdm && make install clean

To configure xdm, edit /etc/ttys and edit the line ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure to say on.

xdm configuration files are located in /usr/local/lib/X11/xdm

Other options include slim, gdm (for GNOME) and wdm (for WindowMaker).


You can install GNOME 3 by running mport install gnome3 or manually building and installing from mports with cd /usr/mports/x11/gnome3 && make install clean. There is also a gnome3-lite port that contains only a subset of gnome for systems with less disk space.

You will need to edit /etc/fstab and add proc /proc procfs rw 0 0 to mount the proc file system.

You should also edit /etc/rc.conf and add gdm_enable="YES" and gnome_enable="YES" to the file to startup all the relevant services for the GNOME desktop environment. In particular, dbus is required for proper operation.

If you wish to try out gnome manually or use startx rather than gdm to run GNOME, you can instead run the following command. echo "exec /usr/local/bin/gnome-session" > ~/.xinitrc one time to enable GNOME for X.

If you would rather use xdm, you can edit the xsession configuration file as so echo "#!/bin/sh" > ~/.xsession
echo "exec /usr/local/bin/gnome-session" >> ~/.xsession
chmod +x ~/.xsession


Install Xfce with mport install xfce4 or build with cd /usr/mports/x11-wm/xfce4 && make install clean

Setup for manually starting xfce with startx by running echo "exec /usr/local/bin/startxfce4" > ~/.xinitrc

On MidnightBSD 2.1.x or higher, user accounts get a default .xinitrc configuration that will start Xfce if installed.

If using xdm, you can run this to set it up. echo "#!/bin/sh" > ~/.xsession
echo "exec /usr/local/bin/startxfce4" >> ~/.xsession
chmod +x ~/.xsession

Consult the Xfce getting started guide for more information.


To install, run mport install windowmaker.

If you want to install wdm and several other apps, you can run mport install windowmaker-desktop or via mports with cd /usr/mports/x11/windowmaker-desktop && make install clean

To add on GNUstep, you can install it via mport install gnustep and also add apps with mport install gnustep-app

On MidnightBSD 2.1.x or higher, user accounts get a default .xinitrc configuration that will start WindowMaker if installed.