Setting up the st terminal

April 06, 2020 • 2 min read

Lately I’ve been looking at Suckless’ programs and I wanted to try out the st terminal. Although I can’t say it’s particularly hard to set up, there were definitely some gotchas along the way. I’ll outline these here so I can hopefully save you some time if you’re interested in setting st up too.

Why st

I wanted to try something new coming from urxvt. Something more minimal. That’s where Suckless comes into play. Their philosophy is one of ultimate minimalism and extensibility. This quickly becomes clear when you read the introduction for the st terminal, in which they state:

The popular alternative, rxvt has only 32K lines of code. This is just too much for something as simple as a terminal emulator; it’s yet another example of code complexity.


Contrary to how it may seem at first sight, the installation of st is actually rather trivial. We’re practically just executing two commands. You’ll need some other terminal installed in order to these commands though.

  1. Getting the source code This can be done with git clone or by outright downloading the provided archive and extracting it with tar -xf. Make sure you do this in a directory you want your extracted st folder to live in. I called mine programs.

  2. Installing the program This is as simple as running sudo make clean install from the directory in which the source code is located.

  3. Configuring st Since st is built from source the configuration can be found in the C file config.h. I choose to edit config.def.h because patches apply their config changes there. A new version of config.h is created after compiling if it doesn’t exist yet. If you keep config.h you should merge it back into config.def.h after you or patches apply changes there.


Chances are you’re missing some functionality when running a bare installation of st. Suckless’ programs are meant to be as minimal as possible after all. That’s not to say you’re left completely in the dust if you want something like scrollback support though. st’s patches provide you with an easy way of adding some extra functionality.

I personally chose to apply the following patches:

  • scrollback (for scrollback support)
  • vertcenter (for vertically centering text on lines)
  • xresources (in order to use the color scheme generated by pywal)
  • externalpipe (read st’s screen through a pipe for URL recognition)

That’s all well and good, but how do you apply these patches? This is where it becomes apparent how little the documentation guides you. Other than a few commands at the bottom of the hacking page you’re supposed to figure this out on your own.

This is how I did it:

  1. Download the patch into your st folder. I choose to create a subfolder called patches
  2. Apply the patch with patch --merge -i /path/to/patch.diff. This will use the merge conflict notation if there are problems applying the patch to your current build
  3. Rebuild st with rm -rf config.h && sudo make clean install. This will generate an up-to-date config file and compile the latest changes into your new build

It’s advised to store your source code with Git. This way you can easily revert if something breaks.

As you can see this whole process isn’t exactly rocket science. Due to Suckless’ documentation, or the lack thereof, it can take quite some time to figure out though. That doesn’t mean I regret installing st as it taught me the commands diff and patch. It’s also my first foray into the world of C.

In case you’re interested: you can find my specific build of st in it’s own GitHub repo.

Happy compiling!

Martijn Vos

A software blog showcasing and documenting learnings.
Written by Martijn Vos.

Found a bug? Please file an issue on GitHub

Twitter GitHub