Using X in OpenBSD-6.4 and above

OpenBSD used to use X in the usual way. The default install provided the components, the user created their .xinit file and one could easily use startx to work with their preferred environment.

However, as of 6.5, this is no longer the case. For various reasons they have now changed the procedure for using X. Their faq page on X gives a fairly simple explanation but it wasn't clear to me at first.

During installation, you are asked if you want xenodm to startx with a default of no. Assuming you take the default, once you have logged in as your user, it is easily rectified.

First as root or with doas, you will enable the xenodm display manager using rcctl. In the example, we also start it, but that could wait.
doas rcctl enable xenodm
doas rcctl start xenodm

Rather than an .xinitrc files in your home directory, you will name the fle .xsession. It should work the same way as an .xinitrc file.

Those are the only changes you should have to make. Some people prefer to use the .xinitrc and just link it to ~/.xsession but it shouldn't be necessary.

Once you have logged in, the window manager specified in your ~/.xsession file will open.