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

TerminalTmux

Terminal Problem Overview


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?

Terminal Solutions


Solution 1 - Terminal

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
    

Solution 2 - Terminal

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

Solution 3 - Terminal

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.

Solution 4 - Terminal

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

Solution 5 - Terminal

When I removed some sessions/windows this error went away for me. Apparently I had too many TTY's open.

You can kill sessions/windows from outside tmux with these commands:

tmux kill-session -t <session-name>
tmux kill-window -t <session-name>:<window-name>

Solution 6 - Terminal

In my case Xterm was absent. (But I had the same error on Ubuntu)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser3256740View Question on Stackoverflow
Solution 1 - TerminalbobView Answer on Stackoverflow
Solution 2 - TerminalTatshView Answer on Stackoverflow
Solution 3 - TerminalShawn WangView Answer on Stackoverflow
Solution 4 - TerminalBeeno TungView Answer on Stackoverflow
Solution 5 - TerminalgitaarikView Answer on Stackoverflow
Solution 6 - TerminalAndreyView Answer on Stackoverflow