Apart from being an aparent Linux user, I’m also a fan of FreeBSD. A few years ago I challenged myself to perform all work related tasks on a FreeBSD machine for 6 months. It turned out that FreeBSD’s been working out quite well as a general usage work desktop.
Today, I’d like to share a quick solution to a small annoying issue that may or may not affect you when you’re using FreeBSD. Basically, when I ssh from my Linux machine, which uses Alacritty terminal, to the remote FreeBSD machine at work I am not able to resume my tmux session.
Here is the message produced on the remote FreeBSD machine when I attempted to attach to an existing tmux session:
~ ❯❯❯ tmux a
open terminal failed: can't find terminfo database
~ ❯❯❯ echo $TERM
alacritty
The problem wasn’t obvious to me at first. I’d thought it could be that Alacritty terminal wasn’t installed on the FreeBSD machine. After Alacritty was installed, the issue was still there.
According to a discussion about tmux; open terminal failed: can’t find terminfo database #370, one way to fix this was to set the $TERM
to something that the machine/server can understand - one of which is xterm-256color
.
To my surprise, it worked after setting the export TERM=xterm-256color
.
I’m using ZSH on the FreeBSD, and here what I had in the file ~/.zshrc
.
...
case "$TERM" in
alacritty)
export TERM="xterm-256color"
;;
esac
Here is the output after ssh-ing from my Linum machine (on Alacritty terminal).
~ ❯❯❯ echo $TERM
xterm-256color
Reference: