If you’re using Ghostty terminal and connecting to GCP compute instances, you’ve probably hit this error:

Error opening terminal: xterm-ghostty.

The official Ghostty documentation provides a solution, but it assumes you have direct SSH access. When you’re using gcloud compute ssh instead, the standard approach doesn’t work.

TLDR

Replace the SSH command from the docs with the GCP equivalent:

Official docs:

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

For GCP:

infocmp -x xterm-ghostty | \
  gcloud compute ssh INSTANCE-NAME \
    --zone="YOUR-ZONE" \
    --project="YOUR-PROJECT" \
    --command="tic -x -"

You’ll see a harmless warning about older tic versions — this can be safely ignored. After running this once, less, man, and other terminal programs will work properly over your GCP SSH connection.

The Problem

Ghostty uses a custom terminfo entry called xterm-ghostty to advertise its capabilities. When you SSH into a remote machine that doesn’t have this terminfo entry installed, you’ll encounter errors like:

  • Error opening terminal: xterm-ghostty.
  • missing or unsuitable terminal: xterm-ghostty
  • WARNING: terminal is not fully functional

This breaks common tools like less, man, vim, and anything else that queries terminal capabilities.

Why the Standard Solution Doesn’t Work

The Ghostty documentation provides this command for SSH:

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

This pipes your local terminfo database entry to the remote server’s tic command, which compiles and installs it. Simple and elegant — but only if you’re using ssh directly.

When you’re working with Google Cloud Platform, you typically connect using:

gcloud compute ssh instance-name --zone=us-central1-b

This wraps SSH with authentication, project selection, and other GCP-specific handling. The standard pipe-to-SSH approach doesn’t translate directly.

The GCP Solution

The fix is straightforward — adapt the command to use gcloud compute ssh with its --command flag:

infocmp -x xterm-ghostty | gcloud compute ssh instance-1 \
  --zone="us-central1-b" \
  --project="twe-gcp" \
  --command="tic -x -"

Breaking this down:

  • infocmp -x xterm-ghostty — exports your local Ghostty terminfo entry
  • gcloud compute ssh instance-1 — connects to your GCP instance
  • --zone="us-central1-b" — specifies the instance zone
  • --project="twe-gcp" — specifies your GCP project
  • --command="tic -x -" — runs the tic command on the remote server, reading from stdin

The -x flag tells tic to use extended terminfo format, and the - tells it to read from standard input rather than a file.

Expected Output

When you run this command, you’ll likely see:

"<stdin>", line 2, col 31, terminal 'xterm-ghostty': older tic versions may treat the description field as an alias

This warning is harmless and mentioned in the official docs — it’s just tic noting that older versions might interpret things slightly differently. The terminfo has been successfully installed.

Verifying It Works

Connect to your instance normally:

gcloud compute ssh instance-1 --zone="us-central1-b" --project="twe-gcp"

Then test:

echo $TERM          # Should show: xterm-ghostty
less /etc/hosts     # Should work without errors
man ls              # Should display the manual page

Alternative: Two-Step Approach

If you prefer being more explicit, you can break this into separate copy and install steps:

# Step 1: Generate and copy the terminfo file
infocmp -x xterm-ghostty > /tmp/xterm-ghostty.ti
gcloud compute scp /tmp/xterm-ghostty.ti instance-1:/tmp/ \
  --zone="us-central1-b" \
  --project="twe-gcp"

# Step 2: Install it on the server
gcloud compute ssh instance-1 \
  --zone="us-central1-b" \
  --project="twe-gcp" \
  --command="tic -x /tmp/xterm-ghostty.ti"

The one-liner is cleaner, but this approach gives you more control and makes it easier to see what’s happening at each step.

Where the Terminfo Gets Installed

By default, tic tries to install terminfo entries to /usr/share/terminfo. If it doesn’t have write access there (which is common for non-root users), it falls back to ~/.terminfo in your home directory.

You can verify the installation location:

gcloud compute ssh instance-1 --zone="us-central1-b" --command="ls -la ~/.terminfo/x/"

You should see xterm-ghostty in the output.

Quick Workaround: Force a Compatible TERM

If you don’t want to install the terminfo entry, you can force Ghostty to use a more common terminal type:

gcloud compute ssh instance-1 --zone="us-central1-b" \
  -- -t "export TERM=xterm-256color; exec bash -l"

This works, but you’ll lose Ghostty’s advanced features like colored and styled underlines. The terminfo installation approach is cleaner and preserves full functionality.

Shell Integration Alternative

If you’re connecting to many GCP instances regularly, you might want to explore Ghostty’s shell integration features. While these are designed for traditional SSH, they could potentially be adapted for GCP workflows:

  • shell-integration-features = ssh-terminfo — automatically copies terminfo on first login
  • shell-integration-features = ssh-env — falls back to xterm-256color

These features currently work with standard SSH but not directly with gcloud compute ssh. However, since gcloud wraps SSH under the hood, there may be ways to make this work with custom SSH config.

Wrap Up

The Ghostty terminfo issue is a common stumbling block when moving between modern terminals and remote servers. The official documentation assumes direct SSH access, but GCP’s authentication wrapper is easy to work with once you know the pattern.

One command and you’re done — no more terminal capability errors, and less works exactly as it should.