1. No X installed
    1. /etc/mk.conf
    2. Install xorg
    3. Configure Xorg
    4. Additional configuration
    5. ~/.Xresources
    6. ~/.xinitrc

No X installed

Assuming you have just made a clean install of NetBSD and you have not installed the X11 sets, you should do the following:


Edit your /etc/mk.conf and add the following line:


Install xorg

Provided that your pkgsrc tree lies in /usr/pkgsrc, type:

# cd /usr/pkgsrc/meta-pkgs/modular-xorg
# make install

Configure Xorg

Usually no configuration is necessary. To start X you use:

$ startx

Additional configuration

Additional adjustments can be made in ~/.xinitrc and ~/.Xresources. For example, you may want to use a different terminal emulator font, such as pkgsrc/fonts/overpass.


To do so, we can add this line to ~/.Xresources:

*font: xft:overpass mono:size=12

For this to take effect, we must do merge it into the database.

$ xrdb -merge ~/.Xresources

To do this at every X startup, we can add it to ~/.xinitrc.


An example ~/.xinitrc to run a window manager and configure keyboard layout:

xrdb merge ~/.Xresources                        # respect ~/.Xresources configuration

setxkbmap -option grp:alt_shift_toggle us,il    # two keyboard options, US keyboard and IL,
                                        # with alt+shift as a toggle option

openbox                                 # run your favourite window manager.