Search code examples
macosxtermterminfo

yet another unknown terminal type


From Ubuntu, I open gnome-terminal, and ssh to a OS X.

OS X version is:

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.9.5
BuildVersion:   13F34

I have for example the file xterm-256color:

$ ls /usr/share/terminfo/78/xterm-256color
/usr/share/terminfo/78/xterm-256color

But I can't do a simple clear:

$ TERM='xterm-256color' clear
'xterm-256color': unknown terminal type.

Solution

  • Your shell may set TERMINFO to some other location than /usr/share/terminfo, and confuse the ncurses library. The ncurses library has a compiled-in fallback value for TERMINFO, which can be overridden by setting the environment variable.

    You may also have (from packages or the like, e.g., homebrew) a copy of clear in your path before /usr/bin/clear which points to an incomplete terminal database.

    For the latter, "which clear" would show where that is the case. If you also have infocmp, the same information is available, e.g., in the first line of its output.

    It is also possible to have a corrupted terminal database (why, I cannot say), and because the ncurses library makes some runtime checks on each entry, it could refuse to load those without apparent cause.