-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Description
Cmd-clicking a file path containing ~ (e.g. ~/Documents/file.txt) fails to open the file on macOS. The path highlights and appears clickable, but nothing happens.
Absolute paths (e.g. /Users/username/Documents/file.txt) work correctly.
Root Cause
In Ghostty.App.swift's openURL(), when the URL string has no scheme it falls through to:
url = URL(filePath: action.url)Swift's URL(filePath:) does not perform tilde expansion. A path like ~/Documents/file.txt produces a URL pointing to a non-existent file, and NSWorkspace.open silently fails.
Suggested Fix
Use NSString.expandingTildeInPath to resolve ~ before constructing the file URL:
let expandedPath = NSString(string: action.url).expandingTildeInPath
url = URL(filePath: expandedPath)Reproduction
- Run a terminal application that outputs file paths with
~prefixes (e.g. Claude Code outputsWritten to ~/Sites/file.md) - Cmd-click the path in Ghostty on macOS
- The file does not open (fails silently)
Environment
- Ghostty 1.2.3 (stable)
- macOS 15 (Darwin 24.6.0)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels