Skip to content

Instantly share code, notes, and snippets.

@nseba
Created June 4, 2026 08:28
Show Gist options
  • Select an option

  • Save nseba/9d96bca064ff1ae06cf21ae26e1bc7a2 to your computer and use it in GitHub Desktop.

Select an option

Save nseba/9d96bca064ff1ae06cf21ae26e1bc7a2 to your computer and use it in GitHub Desktop.
Fixing `'xterm-ghostty': unknown terminal type` over SSH

Fixing 'xterm-ghostty': unknown terminal type over SSH

When connecting to a remote host with Ghostty, commands like clear, tmux, or less may fail with:

'xterm-ghostty': unknown terminal type.

This happens because the remote host doesn't have Ghostty's terminfo entry. Here are three fixes, easiest first.

1. Quick fix (per command)

Override TERM for a single command:

TERM=xterm-256color clear

2. Set TERM for the SSH session

In your local ~/.ssh/config:

Host myserver
    SetEnv TERM=xterm-256color

Requires AcceptEnv TERM on the server (often the default). If it's not set, this silently has no effect.

3. Proper fix — install Ghostty's terminfo on the remote

Export your local xterm-ghostty terminfo and install it into the remote user's ~/.terminfo:

infocmp -x | ssh myserver -- tic -x -

This is the recommended option: it preserves Ghostty's full terminal capabilities instead of downgrading TERM. Options 1 and 2 are fine when you just need it working right now.

@l-velazquez

Copy link
Copy Markdown

Thanks for the fix, I was doing some workarounds, but this is good quality proper fix. Appreciate it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment