lnav icon indicating copy to clipboard operation
lnav copied to clipboard

error: unable to open TUI | reason: the TERM environment variable is set to an unknown value: xterm-ghostty

Open epicwhale opened this issue 4 months ago • 4 comments

lnav version lnav 0.13.2

Describe the bug Using ghostty on mac

✘ error: unable to open TUI reason: unable to initialize notcurses No such file or directory = help: The TERM value of “xterm-ghostty” is not known. Check for your terminal in https://github.com/dankamongmen/notcurses/blob/master/TERMINALS.md or use “xterm-256color”

To Reproduce try lnav with ghostty terminal?

epicwhale avatar Oct 09 '25 07:10 epicwhale

This happens sporadically for me. Not sure what the deal is and it's hard for me to reproduce right now.

tstack avatar Oct 17 '25 03:10 tstack

This will happen if your TERMINFO or TERMINFO_DIRS environment variables don't include a directory that contains the xterm-ghostty file. They're normally set automatically by Ghostty, but maybe it's being overridden in your shell init files?

You can check these by running env | grep TERM. For example on my machine:

$ env | grep TERM

TERMINFO=/Applications/Ghostty.app/Contents/Resources/terminfo
TERM_PROGRAM_VERSION=1.2.3
TERM_PROGRAM=ghostty
COLORTERM=truecolor
TERM=xterm-ghostty

omad avatar Nov 15 '25 01:11 omad

This will happen if your TERMINFO or TERMINFO_DIRS environment variables don't include a directory that contains the xterm-ghostty file. They're normally set automatically by Ghostty, but maybe it's being overridden in your shell init files?

You can check these by running env | grep TERM. For example on my machine:

$ env | grep TERM

TERMINFO=/Applications/Ghostty.app/Contents/Resources/terminfo
TERM_PROGRAM_VERSION=1.2.3
TERM_PROGRAM=ghostty
COLORTERM=truecolor
TERM=xterm-ghostty

Annoyingly, even though I followed the steps here to copy it to my remote server, i ended up still facing the same error with lnav: https://ghostty.org/docs/help/terminfo#ssh

So I ended up just reconfiguring the ssh connecting env to use xterm-256color

# .ssh/config
Host example.com
  SetEnv TERM=xterm-256color

Given lnav is a modern TUI, it would be cool if it implicitly supported the ghostty xterm as it's getting popular :)

epicwhale avatar Nov 18 '25 09:11 epicwhale

I think that updating the vendored copy of notcurses should pull in native support for ghostty.

omad avatar Nov 18 '25 09:11 omad