Skip to main content

Command Configuration

Default Command

If not set, Ghostty uses:
  1. $SHELL environment variable
  2. passwd entry (user information)
Include arguments in the command string:
Ghostty executes this via /bin/sh -c for shell expansion.

Command Execution Modes

direct mode avoids the /bin/sh roundtrip but doesn’t support shell features like:
  • Arguments with spaces
  • Tilde expansion (~)
  • Globs (*.txt)
  • Shell variables

Initial Command

Subsequent terminals use the command setting.
Use the -e flag for a convenient shortcut:
This automatically:
  • Disables shell expansion
  • Sets gtk-single-instance=false
  • Sets quit-after-last-window-closed=true
  • Sets shell-integration=detect (if not none)

Environment Variables

These variables override Ghostty’s automatic variables (like GHOSTTY_RESOURCES_DIR).They do not affect commands run by Ghostty for other purposes (like open or xdg-open for URLs).Available since 1.2.0.

Command Input

Send data to command on startup:
Input is sent as-is. Be cautious with control characters - they can execute programs in a shell.Files are limited to 10MB. Don’t use special files like /dev/stdin or /dev/urandom (they’ll block startup).
Repeatable configuration. Data is concatenated directly with no separator.If any input source doesn’t exist, no input is sent at all.Changes only affect new terminals.Available since 1.2.0.

Command Behavior

Wait After Command

Terminal stays open until any keypress. Useful for scripts and debugging.

Abnormal Exit Detection

Shows error message when process exits too quickly.
Requires non-zero exit code.

Confirm Close

When true, Ghostty uses shell integration to detect if a process is running. Without shell integration, always confirms.

Scrollback

Scrollback Limit

This is the total memory for scrollback + active screen. Enough memory is always allocated for the visible screen; leftover is scrollback.Scrollback is allocated lazily, so large values don’t immediately consume memory.This is per terminal surface, not application-wide.Changes only affect new terminals.
Unlimited scrollback is not currently possible (planned for future).

Scrollbar Visibility (macOS)

macOS only. GTK doesn’t yet support scrollbars.With never, you can still scroll via mouse, keybinds, etc.

Scroll to Bottom

Options:
  • keystroke: Scroll to bottom on keypress that sends data to PTY
  • output: Scroll to bottom on new output (currently unimplemented)
Prefix with no- to disable an option.

Mouse Behavior

Mouse Reporting

Toggle at runtime with toggle_mouse_reporting keybind.

Mouse Shift Capture

  • false/never: Apps can request shift with XTSHIFTESCAPE (or not with never)
  • true/always: Shift sent by default, apps can toggle with XTSHIFTESCAPE (or not with always)
Use never if you always want shift to extend selection.

Mouse Scroll Multiplier

Value is clamped to [0.01, 10,000]. Both extremes provide a bad experience.

Hide Mouse While Typing

Mouse reappears on movement, button press, etc.
Platform behavior may show mouse in other scenarios (e.g., macOS shows mouse when creating new windows/tabs/splits).

Click to Move Cursor

Requires shell integration (specifically prompt marking via OSC 133). Only works in primary screen mode.Works by synthesizing arrow key movements. Some edge cases may behave unexpectedly.

Click Repeat Interval

Default determined by OS settings.

Right-Click Action

Focus Follows Mouse

Only applies to the currently focused window. Hovering over unfocused windows doesn’t change focus.

Selection

Selection Colors

See Appearance Configuration for selection color options.

Selection Behavior

selection-clear-on-typing is triggered by:
  • Any non-modifier keypress that sends data to PTY
  • Preedit/composition start (e.g., Japanese input)
Selection can still be cleared by clicking once or pressing Escape.
selection-clear-on-copy only applies to copy_to_clipboard keybind action, not copy-on-select.

Copy on Select

Middle-click paste always uses the selection clipboard, even when copy-on-select = false.

Selection Word Characters

Used for double-click word selection. Null character (U+0000) is always a boundary.
Remove ; from the default value:
Only single codepoints supported. Multi-codepoint sequences (emoji) not supported.Available since 1.3.0.

Clipboard

Clipboard Access

Controls program access to clipboard via OSC 52.

Clipboard Paste Protection

Prevents copy/paste attacks where pasted text contains newlines that execute commands.

Clipboard Trimming

Only trims trailing whitespace on lines with other characters. Blank lines always trimmed.

Clipboard Codepoint Mapping

Does not apply to URL copying (only text copying).Later entries override earlier ones for overlapping ranges.

Shell Integration

Auto-Injection

Shell integration enables:
  • Working directory reporting (for directory inheritance)
  • Prompt marking (for jump_to_prompt keybind)
  • No confirmation when closing at a prompt
  • Better prompt repainting on resize
You can manually source the integration script even with shell-integration = none.

Shell Integration Features

Available features:
Set cursor to a bar at the prompt.
Set sudo wrapper to preserve terminfo.
Set window title via shell integration.
SSH environment variable compatibility:
  • Converts TERM from xterm-ghostty to xterm-256color on remote hosts
  • Propagates COLORTERM, TERM_PROGRAM, TERM_PROGRAM_VERSION
Requires remote sshd_config to accept these variables.(Available since 1.2.0)
Automatic terminfo installation on remote hosts:
  • Installs Ghostty’s terminfo entry using infocmp and tic
  • Requires infocmp locally, tic on remote hosts
  • Automatically cached to avoid repeat installations
Manage cache with ghostty +ssh-cache CLI action.(Available since 1.2.0)
Add Ghostty’s binary directory to PATH. Ensures ghostty command is available even if shell init scripts reset PATH.Particularly useful on macOS where PATH is often overridden. Only added if not already present.
SSH features work independently and can be combined:
  • Both ssh-env + ssh-terminfo: Use xterm-ghostty with terminfo installation, fallback to xterm-256color with env vars if installation fails
  • Just ssh-env: Always use xterm-256color with env vars
  • Just ssh-terminfo: Install terminfo and use xterm-ghostty

Command Notifications (GTK)

When to Notify

GTK only. Requires shell integration or OSC 133 sequences.GTK context menu has an option to enable notifications for a single command.Available since 1.3.0.

Notification Action

Options:
  • bell: Terminal bell (enabled by default)
  • notify: System notification (disabled by default)
GTK only. Available since 1.3.0.

Notification Threshold

GTK only. Available since 1.3.0.

Terminal Features

Image Storage

Limit is per screen (primary and alternate), so effective limit per surface is double.Maximum value: 4,294,967,295 (4GiB).

Title Reporting

Security risk: Can expose sensitive information or enable code execution with crafted titles. Only enable if you trust all running programs.Available since 1.0.1.

KAM Mode

Rare feature. If you don’t know you need KAM, you don’t need it.

OSC Color Reporting

Controls format for OSC 4/10/11 color queries.

Working Directory

This is secondary to window-inherit-working-directory. Inheritance takes precedence if a previous terminal exists.Typically only used for the first window.
Platform defaults:
  • macOS: home if launched from launchd or open
  • Linux/GTK: home if launched from desktop launcher
  • Otherwise: inherit

Quit Behavior

Quit After Last Window

Default false matches standard macOS app behavior (app stays running).

Quit Delay (Linux)

Linux only. Only has effect if quit-after-last-window-closed = true.Minimum value: 1s.

Resources

Shell Integration

Detailed shell integration guide

SSH Configuration

Using Ghostty with SSH

Keybindings

Terminal-related keybind actions

Window Settings

Window and tab configuration