Skip to main content
Ghostty’s shell integration provides enhanced terminal features like semantic prompt detection, cursor shape control, and improved sudo/SSH workflows. Integration is automatic for supported shells.

Supported Shells

Shell integration is available for:
  • Bash (requires Bash 4.0+, automatic integration requires standard Bash)
  • Fish (automatic)
  • Zsh (requires Zsh 5.1+, automatic)
  • Elvish (manual import required)
  • Nushell (automatic)

Features Provided

Semantic Prompts

OSC 133 sequences mark prompts, commands, and output for better navigation and selection

Cursor Control

Automatic cursor shape changes: bar at prompt, block during command execution

Sudo Integration

Automatically preserves terminfo when using sudo

SSH Integration

Copies terminfo to remote hosts for proper terminal behavior

Setup by Shell

Bash

Shell integration is automatic for standard Bash installations. Ghostty starts Bash in POSIX mode with the ENV environment variable set to load the integration script.No manual configuration needed.

Fish

Automatic integration via XDG_DATA_DIRS. Ghostty prepends its shell integration directory, and Fish automatically loads configuration files from <XDG_DATA_DIR>/fish/vendor_conf.d/*.fish on startup. No manual setup required.

Zsh

1

Check if automatic integration works

Automatic integration works by temporarily setting ZDOTDIR to Ghostty’s integration directory.If your environment doesn’t set ZDOTDIR in system-wide files like /etc/zshenv, automatic integration should work.
2

Manual setup (if needed)

If automatic integration doesn’t work, add this to your ~/.zshrc:
Requires Zsh 5.1 or later (released September 2015).

Elvish

1

Understand automatic module loading

Ghostty prepends $GHOSTTY_RESOURCES_DIR/src/shell-integration to XDG_DATA_DIRS, making the ghostty-integration module available.
2

Import the module

Add to your ~/.config/elvish/rc.elv:
Elvish integration is community-supported. The Ghostty team distributes it but does not officially support it.

Nushell

Automatic integration using Nushell’s vendor autoload mechanism. Ghostty automatically imports the module using the -e "use ghostty *" flag. Manual loading (if shell integration is disabled):

Shell Integration Features

Controlling Features

Customize which integration features are enabled:
~/.config/ghostty/config
Available features:
  • cursor - Automatic cursor shape changes
  • sudo - Terminfo preservation for sudo
  • title - Window title updates

Cursor Behavior

With cursor integration enabled:
  • At prompt: Cursor becomes a bar (vertical line)
  • During execution: Cursor returns to default (usually block)
Disable cursor integration if you prefer manual control:

Sudo Integration Example

The sudo feature wraps the sudo command to preserve $TERMINFO:

SSH Integration

The SSH features help copy terminfo to remote hosts:

Prompt Markers (OSC 133)

Shell integration uses OSC 133 sequences to mark semantic regions:
  • OSC 133 A: Prompt start
  • OSC 133 B: Prompt end (command start)
  • OSC 133 C: Command execution start
  • OSC 133 D: Command end
These markers enable features like:
  • Selecting entire command output
  • Scrolling between prompts
  • Visual prompt indicators

Environment Variables

Shell integration sets these environment variables:

Troubleshooting

Check if $GHOSTTY_RESOURCES_DIR is set:
If empty, you’re not running in Ghostty or automatic integration failed. Use manual setup.
Ensure cursor integration is enabled:
Check your config doesn’t have shell-integration-features = no-cursor.
Verify the sudo feature is enabled:
Ensure $TERMINFO is set:

Disabling Shell Integration

To completely disable shell integration:
~/.config/ghostty/config