Install the prerequisite

  • By default, you have the FreeBSD system installed and running properly
  • If you log in to the system as a non-root user, that is, you have a non-root user

Install X Windows

$ sudo pkg install xorg
Copy the code

FreeBSD normally does not have sudo, so you need to install sudo as user root.

$ pkg install sudo 
Copy the code

Modify your user’s permissions in the sudo file

$ visudo
Copy the code

In normal mode of vi editor, use /ALL search to locate root ALL(ALL) ALL. Add:

User name ALL(ALL) ALLCopy the code

The user name is the user name you set yourself, just replace it, and then re-install xorg using the command.

Install the DWM

DWM uses git to clone the source files from DWM’s official website. If you don’t have Git you can install it first:

$ sudo pkg install git

$ git clone https://git.suckless.org/dwm

$ cd dwm
Copy the code

Go to DWM’s source folder, which contains the following files:

At this point, we have to pay attention becauseFreeBSDSystem andLinuxSlightly different from system to system, so need to modify the source fileconfig.mkFile:

$ vi config.mk
Copy the code

Modification:

X11INC = /usr/local/include
X11LIB = /isr/local/lib
...
FREETYPEINC = /usr/local/include/freetype2
Copy the code

After modification directly save, save after you can execute compilation!

$ make
$ sudo make install
Copy the code

Start DWM with Startx

Copy the startup file to the user directory:

$ cp /usr/local/etc/X11/xinit/xinitrc ~/.xinitrc
Copy the code

Modifying the startup file:

# Comment out the code for the reciprocal line with a '#' and add the following:
exec dwm
Copy the code

You can then start with Startx

$ startx
Copy the code

Install the st

The original DWM didn’t have a terminal, so we needed to install one, and I chose ST (Simple Terminal) from the same community as Suckless.

Clone st source code from the official website:

$ git clone https://git.suckless.org/st
Copy the code

Open the source code to compile:

$ cd st
Copy the code

As with installing DWM above, we need to modify the config.mk file to complete the installation:

$ vi config.h
Copy the code
X11INC = /usr/local/include
X11LIB = /isr/local/lib
Copy the code

Then compile and install:

$ make
$ make install
Copy the code

This may cause an error:

pkg-config not found
Copy the code

At this point, you just need to install the pkgconf installation package

$ sudo pkg install pkgconf
Copy the code

You can then recompile the installation:

$ make
$ make install
Copy the code

At this point, your DWM and ST are installed.