tmux: open terminal failed: missing or unsuitable terminal: xterm-256color

I used home-brew to setup tmux on a mac. When trying to run tmux I keep on getting this error

open terminal failed: missing or unsuitable terminal: xterm-256color

any suggestions?


Your system doesn't have xterm-256color. You could:

  • Set TERM to something other than xterm-256color outside tmux (try just plain export TERM=xterm).

  • See if there is a package containing xterm-256color, perhaps a later version of ncurses or terminfo.

  • Install it manually from another system with something like:

    infocmp -x xterm-256color > out
    

    Then transfer the "out" file to your Mac and try:

    tic out
    

This happened to me during a system upgrade. Unfortunately I did not see a way besides restarting: tmux kill-server and then run tmux.


you can just type export TERM=xterm in console when you see this error, or put export TERM=xterm in the file ~/.bash_profile and source ~/.bash_profile. then you may never get this error again.
This works fine on my debian.


TL;DL

sudo ln -sf /usr/share/terminfo/x/xterm-color /usr/share/terminfo/x/xterm-256color

Details

Maybe the file /usr/share/terminfo/x/xterm-256color is corrupted. It may be fixed upon (system/package) upgrade / reinstall.

Meanwhile you can use other terminfo entry. You can get the available options by ls /usr/share/terminfo/x.

I am having the same problem and using xterm-16color meanwhile.

To set terminfo, you can type reset in the terminal, then select the terminfo:

username:~$ cd /usr/share/terminfo/x
username:x$ ls
x10term          xnuppc+200x64    xterm-24         xterm+pcfkeys
x1700            xnuppc-200x64-m  xterm-256color   xterm-pcolor
x1700-lm         xnuppc-200x75    xterm+256color   xterm-r5
...
username:x$ reset
reset: unknown terminal type xterm-256color
Terminal type? xterm-16color

=== Edit 2018 Feb 20 ===

You should config the term in many places if you want to make to permantent, for example, .vimrc, .tmux.config, .Xresources, e.t.c.

I still have issue when using terminator -x 'tmux attach -t music; exec bash' So I'm using a quick hack as below:

cd /usr/share/terminfo/x
sudo mv xterm-256color xterm-256color.bk
sudo ln -sf /usr/share/terminfo/x/xterm-color /usr/share/terminfo/x/xterm-256color