Skip to main content
  1. posts/

Ghostty — Workaround for Missing or Unsuitable Terminal xterm-ghostty

·379 words·2 mins·
Author
Christian Mohn
IT veteran, podcaster, author, and blogger from Bergen, Norway.
Table of Contents

Ghostty screenshot
The freshly made public Ghostty terminal emulator by Mitchell Hashimoto (co-founder of Hashicorp) is all the rage at the moment, and it definitely looks interesting:

Ghostty is a terminal emulator that differentiates itself by being fast, feature-rich, and native. While there are many excellent terminal emulators available, they all force you to choose between speed, features, or native UIs. Ghostty provides all three.

I decided to give it a spin on my Macbook, and see if it offers any improvements over Wezterm, which is my current terminal emulator of choice.

So far so good, it seems to work very well and offers quite a few customization options.

Also worth noting is ghostty.zerebos.com that offers a Ghostty config tool.

The first real issue I had with it, was when using SSH to connect to remote resources. This produced the missing or unsuitable terminal: xterm-ghostty error message, because the remote resource doesn’t have the xterm-ghostty terminfo defined. The official Ghostty docs has some workarounds for it, but these are either to convoluted like copying terminfo entries to all remote systems, or setting SetEnv TERM=xterm-256color in .ssh/config for each remote host. The other alternative is to set SetEnv TERM=xterm-256color system wide but that also affects other terminal emulators (as does setting it in .ssh/config)

Workaround
#

My workaround for it, is to set the TERM variable in my .zsrc file, but only if Ghostty is the terminal emulator in use (as Wezterm doesn’t have this issue). This way I don’t have to do it for every remote host, or copy terminfo for Ghostty to them.

This is simple do to, as the $TERM_PROGRAM variable contains the name of the emulator currently in use. Add the following to your .zsrc file, and the TERM=xterm-256color variable declaration is only done when .zsrc is processed in Ghostty and not in other terminal emulators.

if [[ "$TERM_PROGRAM" == "ghostty" ]]; then
    export TERM=xterm-256color
fi

Update

Update 16th of September 2025:

Ghostty v1.2.0 has been released, which works around this problem. PR: #7608 SSH Improvements (Work-in-Progress) introduces the ability to set shell-integration-features = ssh-env,ssh-terminfo in the Ghostty config file. ssh-env sets environment compatibility, and ssh-terminfo installs the required terminfo on the remote host. This removes the need for the workaround above. See the release notes for details.

Related