Skip to main content
  1. posts/

Ghostty — Workaround for Missing or Unsuitable Terminal xterm-ghostty

·317 words·2 mins·
Christian Mohn
zsh terminal emulator Ghostty
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

Related

Beware Of The Rogue VMs!
·548 words·3 mins
Christian Mohn
vSphere ESXi vCenter VMware Security
Rickrolling WiFi at VMware Explore Barcelona 2024
·240 words·2 mins
Christian Mohn
WiFi VMware Explore ESP32
GL-iNet Opal (GL-SFT1200) Travel Router: First Impressions
·572 words·3 mins
Christian Mohn
GL-iNet networking DNS WireGuard Opal