Fixing Ghostty SSH Terminfo Issues

I recently switched to Ghostty as my terminal on my Mac and overall it's been great. However, when I SSH'd into my Linux machine, things got weird pretty quickly. Every character I typed was being repeated on screen, backspace wasn't working properly, and arrow keys were printing raw escape sequences instead of moving the cursor. On top of that I was getting errors like:

Error opening terminal: xterm-ghostty.

or sometimes:

WARNING: terminal is not fully functional

The repeating characters and broken input are a direct symptom of the remote machine not understanding your terminal type. Because it doesn't know what xterm-ghostty is capable of, it falls back to some very broken assumptions about how to handle input and output, which results in the garbled behaviour.

The root cause is that Ghostty uses its own terminfo entry (xterm-ghostty) to describe its capabilities to terminal applications. When you SSH into a remote machine, that machine needs to have the same terminfo entry available, otherwise it has no idea how to talk to your terminal properly. My Linux machine didn't have it.

The Fix

The fix is a one-liner that copies Ghostty's terminfo entry from your Mac to the remote machine:

infocmp -x xterm-ghostty | ssh your-server -- tic -x -

That's it. No more errors.

What's Actually Happening

infocmp reads the terminfo entry for xterm-ghostty from your local machine and dumps it to stdout. That output is then piped over SSH to the remote machine, where tic compiles it and installs it. The -x flags tell both commands to handle extended terminal capabilities, and the trailing - tells tic to read from stdin rather than a file.

Once installed, the remote machine knows exactly what xterm-ghostty is and what it can do, and the errors go away.

If tic can't write to the system terminfo directory, it will fall back to ~/.terminfo on the remote machine, which works just as well for your own user session.

If you're on a Mac running a version older than Sonoma, the system infocmp might be too old and will throw Illegal character errors. In that case, install a newer version of ncurses via Homebrew and use the full path instead: /opt/homebrew/opt/ncurses/bin/infocmp -x xterm-ghostty | ssh your-server -- tic -x -

Full docs on this from the Ghostty team are here: ghostty.org/docs/help/terminfo