Terminfo

Terminfo is used to tell software about the terminal's capabilities. Ghostty ships with its own terminfo entry to advertise its features.

Terminfo is an archaic format still in use by many terminal applications to determine the capabilities of the terminal. Ghostty ships with its own terminfo entry to advertise its features.

Ghostty uses the TERM value of xterm-ghostty.

Note

Why the xterm prefix? Unfortunately, many terminal applications string search for "xterm" in the TERM value to assume capabilities. During the private beta, we experimented with a pure ghostty value, but found that too many applications broke and fixing the entire ecosystem was unrealistic. We settled on xterm-ghostty to maintain compatibility.

Ghostty packages include the terminfo entry and set the proper filesystem layouts or environment variables to make it available to the system. When you run Ghostty, it will automatically set the TERM environment variable to xterm-ghostty so long as it detects that the terminfo entry is available.

Sudo

If you use sudo, sudo may reset your environment variables and you may see an error about missing or unsuitable terminal: xterm-ghostty when running some programs.

To resolve this, you must either configure sudo to preserve the TERMINFO environment variable, or you can use shell-integration with the sudo feature enabled and Ghostty will alias sudo to automatically do this for you. To enable the shell-integration feature specify shell-integration-features = sudo in your configuration.

SSH

If you use SSH to connect to other machines that do not have Ghostty's terminfo entry, you will see error messages like missing or unsuitable terminal: xterm-ghostty.

Hopefully someday Ghostty will have terminfo entries pre-distributed everywhere, but in the meantime there are two ways to resolve the situation:

  1. Copy Ghostty's terminfo entry to the remote machine.
  2. Configure SSH to fall back to a known terminfo entry.

Copy Ghostty's terminfo to a remote machine

The following one-liner will export the terminfo entry from your host and import it on the remote machine:

infocmp -x | ssh YOUR-SERVER -- tic -x -

The tic command on the server may give the warning "<stdin>", line 2, col 31, terminal 'xterm-ghostty': older tic versions may treat the description field as an alias which can be safely ignored.

Note

macOS versions before Sonoma cannot use the system-bundled infocmp. The bundled version of ncurses is too old to emit a terminfo entry that can be read by more recent versions of tic, and the command will fail with a bunch of Illegal character messages. You can fix this by using Homebrew to install a recent version of ncurses and replacing infocmp above with the full path /opt/homebrew/opt/ncurses/bin/infocmp.

Configure SSH to fall back to a known terminfo entry

If copying around terminfo entries is untenable, you can override TERM to a fallback value using SSH config.

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

Requires OpenSSH 8.7 or newer. The 8.7 release added support for setting TERM via SetEnv.

Warning

Fallback does not support advanced terminal features. Because xterm-256color does not include all of Ghostty's capabilities, terminal features beyond xterm's like colored and styled underlines will not work.