Since I use st I ideally want to have my TERM environment variable set correctly as st-256color and not have to lie that it's xterm-color (even if that is the easiest option). St comes with easy to follow instructions for setting terminfo:

tic -s st.info

On linux this works as intended and creates a ~/.terminfo directory if it doesn't already exist and creates the necessary entries under that. On NetBSD this "works", but doesn't actually do what you'd hoped: it just creates a st.info.cdb file in the same directory. This is because NetBSD uses some form of a constant database format as opposed to Linux's directory approach. I have absolutely no idea how to append to NetBSD's system wide /usr/share/misc/terminfo.cdb because I can't find any tools that can read or write to it beyond the low-level C functions. However, you can do the following (as suggested in NetBSD's tic man page).

cp /path/to/st.info ~/.terminfo
tic ~/.terminfo

which will create a ~/.terminfo.cdb file. I then also copied this to /root/.terminfo.cdb so I don't have problems with vi there.

Then I just needed a few moments of confusion before I remembered that I'd set the default terminal in Tmux to xterm-color quite some time back and that's why $TERM was still incorrect!

So far, the only thing that doesn't like st-256color is Snownews, where I get display glitches. So for that I've aliased snownews to export TERM=xterm-color;snownews;export TERM=st-256color and it's all hunky-dory again.


[EDIT: 2015-10-29] Gerard Lally wrote to me to let me know there is a better way to do this:

It dawned on me earlier that there's a very obvious way to append the rxvt-unicode terminfo to the NetBSD system-wide database: just cat it to the end of terminfo in /usr/share/misc and create a new database with tic!

In other words:

cd /usr/share/misc
# backup existing database
mv terminfo.cdb terminfo.cdb-bak
# append rxvt unicode terminfo to system terminfo
cat ~/rxvt-unicode.terminfo >> terminfo
# create new database
tic -s terminfo

This creates a new database and there's no need for .terminfo.cdb in either root or user's home.