ghostty-terminfo

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Ghostty Terminfo Installation

Ghostty Terminfo 安装指南

Overview

概述

Ghostty uses
xterm-ghostty
as its
$TERM
value. Remote hosts that lack this terminfo entry will show broken terminal behavior. The fix is to transfer the terminfo from the local machine to the remote host.
Ghostty 使用
xterm-ghostty
作为其
$TERM
值。缺少该terminfo条目的远程主机会出现终端行为异常。解决方法是将本地机器的terminfo传输到远程主机。

When to Use

适用场景

  • Remote SSH sessions show "unknown terminal type xterm-ghostty"
  • Missing colors, broken backspace/arrow keys, or garbled output over SSH
  • Setting up a new remote host for use with Ghostty
  • Writing SSH scripts that should handle Ghostty terminfo automatically
  • 远程SSH会话显示“unknown terminal type xterm-ghostty”
  • SSH连接时出现颜色缺失、退格/方向键失效或输出乱码
  • 为使用Ghostty配置新的远程主机
  • 编写可自动处理Ghostty terminfo的SSH脚本

Quick Reference

快速参考

TaskCommand
Check if remote has terminfo
ssh HOST 'infocmp xterm-ghostty >/dev/null 2>&1'
Install terminfo on remote
infocmp -x xterm-ghostty | ssh HOST tic -x -
One-liner check + install
ssh HOST 'infocmp xterm-ghostty >/dev/null 2>&1' || infocmp -x xterm-ghostty | ssh HOST tic -x -
Verify after install
ssh HOST 'infocmp xterm-ghostty >/dev/null 2>&1 && echo OK'
任务命令
检查远程主机是否有terminfo
ssh HOST 'infocmp xterm-ghostty >/dev/null 2>&1'
在远程主机安装terminfo
infocmp -x xterm-ghostty | ssh HOST tic -x -
检查+安装一键命令
ssh HOST 'infocmp xterm-ghostty >/dev/null 2>&1' || infocmp -x xterm-ghostty | ssh HOST tic -x -
安装后验证
ssh HOST 'infocmp xterm-ghostty >/dev/null 2>&1 && echo OK'

Implementation

实施步骤

Local Install

本地安装

If you're already on the machine, just pipe it directly to
tic
:
bash
infocmp -x xterm-ghostty | tic -x -
如果已经在目标机器上,直接通过管道传输给
tic
bash
infocmp -x xterm-ghostty | tic -x -

One-Time Install

一次性安装

bash
infocmp -x xterm-ghostty | ssh user@host tic -x -
This exports the local terminfo and compiles it on the remote host. Only needs to run once per remote machine.
bash
infocmp -x xterm-ghostty | ssh user@host tic -x -
这会导出本地的terminfo并在远程主机上编译。每台远程主机只需运行一次。

Conditional Install in SSH Scripts

SSH脚本中的条件安装

bash
if [ "$TERM" = "xterm-ghostty" ]; then
  ssh "$HOST" 'infocmp xterm-ghostty >/dev/null 2>&1' || \
    infocmp -x xterm-ghostty | ssh "$HOST" tic -x -
fi
Only runs when connecting from Ghostty, skips if already installed.
bash
if [ "$TERM" = "xterm-ghostty" ]; then
  ssh "$HOST" 'infocmp xterm-ghostty >/dev/null 2>&1' || \
    infocmp -x xterm-ghostty | ssh "$HOST" tic -x -
fi
仅当从Ghostty连接时运行,如果已安装则跳过。

Common Mistakes

常见错误

  • Running from non-Ghostty terminal -
    infocmp xterm-ghostty
    fails if the local machine doesn't have the terminfo. Run from Ghostty or a machine with Ghostty installed.
  • Forgetting
    -x
    flag
    - Both
    infocmp -x
    and
    tic -x
    need the extended flag to preserve Ghostty's extended capabilities.
  • Workaround instead of fix - Setting
    TERM=xterm-256color
    before SSH works but loses Ghostty-specific features. Install the terminfo instead.
  • 从非Ghostty终端运行 - 如果本地机器没有该terminfo,
    infocmp xterm-ghostty
    会失败。请从Ghostty或已安装Ghostty的机器运行。
  • 忘记
    -x
    标志
    -
    infocmp -x
    tic -x
    都需要使用扩展标志来保留Ghostty的扩展功能。
  • 使用替代方案而非修复 - SSH前设置
    TERM=xterm-256color
    可以生效,但会丢失Ghostty的特定功能。建议安装terminfo。