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
- Automatic (Standard Bash)
- Manual (macOS /bin/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 viaXDG_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
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.Requires Zsh 5.1 or later (released September 2015).
Elvish
Understand automatic module loading
Ghostty prepends
$GHOSTTY_RESOURCES_DIR/src/shell-integration to XDG_DATA_DIRS, making the ghostty-integration module available.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
cursor- Automatic cursor shape changessudo- Terminfo preservation for sudotitle- 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)
Sudo Integration Example
The sudo feature wraps thesudo 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
- Selecting entire command output
- Scrolling between prompts
- Visual prompt indicators
Environment Variables
Shell integration sets these environment variables:| Variable | Description |
|---|---|
GHOSTTY_RESOURCES_DIR | Path to Ghostty’s resource directory |
GHOSTTY_SHELL_FEATURES | Comma-separated list of enabled features |
GHOSTTY_BIN_DIR | Path to Ghostty binary directory |
TERM | Set to xterm-ghostty |
Troubleshooting
Shell integration not loading
Shell integration not loading
Check if If empty, you’re not running in Ghostty or automatic integration failed. Use manual setup.
$GHOSTTY_RESOURCES_DIR is set:Cursor shape not changing
Cursor shape not changing
Ensure cursor integration is enabled:Check your config doesn’t have
shell-integration-features = no-cursor.Sudo still has terminal issues
Sudo still has terminal issues
Verify the sudo feature is enabled:Ensure
$TERMINFO is set:Disabling Shell Integration
To completely disable shell integration:~/.config/ghostty/config
Related Resources
- Shell integration source code:
~/workspace/source/src/shell-integration/ - Kitty shell integration (similar implementation)
- OSC 133 specification