Unlock Clickable File Links in Ghostty: A Simple eza & Zsh Hack
06-22 发布 | 08-17 更新 | 浏览数 25
Fix Clickable File Hyperlinks in Ghostty Terminal with eza & Zsh Aliases. Learn how to enable one-click file access in Ghostty using eza and Zsh aliases, boosting your productivity.

Problem Background
iTerm2 natively supports OSC 8 hyperlinks generated by modern CLI tools like eza. Hold Cmd and click any file listed by eza --hyperlink, and the file opens instantly.
Ghostty, however, does not parse file path hyperlinks out of the box by default. When you run vanilla ls or even basic eza commands in Ghostty, filenames remain plain static text—no clickable links work without manual configuration. This creates friction if you switch from iTerm2 to Ghostty and want the same one-click file access workflow.
Simple Solution Overview
We use two lightweight, zero-plugin adjustments:
Replace native
lswitheza(Rust-based ls alternative) that outputs standard OSC 8 file hyperlinksCreate permanent Zsh aliases so you keep using familiar
ls/llshortcuts
No complex Ghostty regex link rules or extra Zsh plugins are required.
Step 1: Install eza
macOS (Homebrew)
brew install eza
Debian / Ubuntu
sudo apt update && sudo apt install eza
Step 2: Add Zsh Aliases to Enable Hyperlinks
Open your Zsh config file:
nano ~/.zshrc
Paste these alias lines at the bottom:
# Override ls commands to generate clickable OSC8 hyperlinks
alias ls='eza --hyperlink'
alias ll='eza -l --hyperlink'
alias la='eza -la --hyperlink'
Save the file and reload config to activate immediately:
source ~/.zshrc
Step 3: How to Use Clickable Files in Ghostty
Run ll or ls to list your directory.
macOS: Hold
Cmd+ left-click any filenameLinux: Hold
Ctrl+ left-click any filename
Ghostty will recognize the embedded OSC 8 escape sequences from eza and trigger your system’s default app to open the target file or folder.
Quick Troubleshooting
Click does nothing Confirm the
--hyperlinkflag exists in your aliases, then runsource ~/.zshrcagain to refresh shell settings.Native ls still runs instead of eza Run
type lsto verify the alias loads correctly. If missing, re-save and reload.zshrc.Hyperlinks break inside Tmux Remove
mouse-shift-capture = truefrom your Ghostty config file to restore modifier-click hyperlink behavior.
Wrap-Up
Unlike iTerm2, Ghostty requires explicit OSC 8 hyperlink output from command-line tools to support clickable files. Eza’s built-in --hyperlink flag handles all link formatting, and simple Zsh aliases let you retain your usual directory listing workflow without learning new commands. This minimal setup delivers the exact click-to-open file experience you expect in Ghostty terminal.
