VS Code / Cursor: ⌥⌘C for relative path, right-click → Copy Path for absolute. Zed: ⌘⇧C from the file tab. Xcode: right-click file in Navigator → Copy Full Path. Outside the editor (Finder, Slack, CI): use Pathly.
Copying file paths is something developers do constantly — into PR descriptions, Slack messages, CI configuration files, AI coding prompts, documentation. Each major macOS editor handles it slightly differently, and none of them help you once you've closed the editor or switched to Finder.
This is a complete reference for all four major editors, plus a note on when your editor's path copy isn't the right tool for the job.
VS Code — Two Paths, Two Shortcuts
VS Code offers two distinct path formats, accessible both from the keyboard and the context menu.
Copy Relative Path
This is the one most developers actually want. It gives you the path relative to your workspace root — e.g., src/components/Button.tsx — which is machine-agnostic and suitable for PR comments, README files, and AI coding tool context.
| Action | Keyboard shortcut | Context menu |
|---|---|---|
| Copy Relative Path | ⌥⌘C | Right-click in Explorer → Copy Relative Path |
| Copy Absolute Path | ⌥⌘C then select, or right-click | Right-click in Explorer → Copy Path |
| Copy Path from open tab | Right-click tab title | Copy Path / Copy Relative Path |
In VS Code, ⌥⌘C copies the relative path when the Explorer panel is focused. If an editor pane is focused instead, it may copy the absolute path depending on your keybindings. Right-clicking in the Explorer sidebar is the unambiguous method.
Copy from the Command Palette
If you prefer Command Palette over mouse, press ⌘⇧P, type copy path, and you'll see both "Copy Path" and "Copy Relative Path" as commands you can run and optionally bind to keys.
Cursor — Same Shortcuts, Plus AI Context
Cursor is a fork of VS Code, so all the VS Code path-copy shortcuts work identically:
- Right-click any file in the Explorer: Copy Path or Copy Relative Path
- ⌥⌘C with the file focused in the Explorer
- Right-click a file tab → Copy Path
Where Cursor adds value beyond VS Code is the AI context. When you're writing a prompt in Cursor's Composer, you can reference files with @filename — but for external context (linking to a file in a GitHub issue, pasting a path into Claude or ChatGPT), you still need to copy the path manually using the methods above.
One workflow I use daily: copy a relative path from Cursor with ⌥⌘C, paste it directly into a Claude prompt. Works perfectly. But when the file I need to reference isn't currently open in Cursor — or I'm in Finder looking at assets, build outputs, or non-code files — I reach for Pathly instead. See also: Using File Paths with AI Coding Tools on Mac.
Zed — One Shortcut That Just Works
Zed has a cleaner approach than VS Code: one keyboard shortcut that copies the file path from wherever you're working.
| Action | Keyboard shortcut | Context menu |
|---|---|---|
| Copy file path (full) | ⌘⇧C | Right-click file in Project Panel → Copy Path |
| Copy relative path | Right-click in Project Panel | Copy Relative Path |
⌘⇧C in Zed copies the full absolute path of the currently active file. It works whether you're focused in the editor pane or in the Project Panel. The path lands on your clipboard without any modal or confirmation step — it's fast and reliable.
Zed's shortcut is arguably the most ergonomic of the four editors covered here. The only gap is the same as all editors: it only knows about files currently tracked in a workspace. Files outside Zed's project view require a different approach.
Xcode — Copy from the Navigator Panel
Xcode doesn't have a keyboard shortcut for "copy file path" the way VS Code and Zed do. Instead, the path lives in the Navigator panel (the left sidebar) and is accessible via right-click.
Open the Project Navigator (⌘1) in Xcode.
Right-click the file you want the path for.
Choose "Show in Finder" — then right-click the file in Finder to copy the path.
Or, for a direct path copy without leaving Xcode:
Right-click the file in the Project Navigator.
Choose "Copy Full Path" from the context menu. (Available in Xcode 14+.)
Xcode's "Copy Full Path" gives you the absolute POSIX path. There's no native "copy relative path" option — relative path within your project group structure isn't exposed in the context menu. If you need the relative path for Swift Package Manager or a build script, you'll need to trim the absolute path manually or use a Git-based approach.
The Gap: Paths Outside the Editor
Here's the workflow problem none of the above tools solve: your editor can only give you paths to files it knows about, from inside the editor. The moment you switch to Finder — to share an asset with a designer, reference a build artifact, paste a config file path into a Slack message, or add a file to a CI pipeline — you're on your own again.
That's the gap Pathly fills. When I'm in Cursor working on a project, I use ⌥⌘C constantly. But when I need to reference a file in Finder — whether it's a screenshot, a built binary, a log file, or something in a different directory entirely — I right-click and use Pathly. The two workflows complement each other rather than compete.
Cursor + Pathly is a strong combination: use Cursor's ⌥⌘C for relative paths within your codebase, and Pathly's right-click → Copy Path for everything else. You never have to open Terminal just to grab a path.
Quick Reference: All Editors at a Glance
| Editor | Relative path | Absolute path | From file tab |
|---|---|---|---|
| VS Code | ⌥⌘C (Explorer focused) | Right-click → Copy Path | Right-click tab → Copy Path |
| Cursor | ⌥⌘C | Right-click → Copy Path | Right-click tab → Copy Path |
| Zed | Right-click → Copy Relative Path | ⌘⇧C | ⌘⇧C |
| Xcode | ⚠ Not natively available | Right-click → Copy Full Path | Right-click → Copy Full Path |
| Pathly (Finder) | Copy Git Path | Copy Path | Works outside editors |