CLI Overview
Zed’s command-line interface (CLI) enables you to open files and directories, integrate with development tools, and control Zed from shell scripts and other applications.Installation
macOS
Run thecli: install command from the command palette to install the zed
CLI to /usr/local/bin/zed.
Linux
The CLI is included with Zed packages. The binary name may vary by distribution:- Most distributions:
zed - Some distributions:
zeditor
/usr/local/bin/zed/usr/bin/zed~/.local/bin/zed
Windows
The CLI is included with Zed. Add Zed’s installation directory to your PATH environment variable, or use the full path tozed.exe.
Basic Usage
Line and Column Positioning
Open a file at a specific line:Reading from Standard Input
Read content from stdin by passing- as the path:
URL Support
The CLI can open URLs with these schemes:zed://- Zed-specific URLs (e.g., settings, extensions)http://andhttps://- Web URLsfile://- Local file URLsssh://- SSH remote paths
Version Information
Print Zed’s version and app path:- Release channel (stable, preview, nightly, or dev)
- Version number
- Commit SHA (if available)
- Path to the Zed binary
Using Zed as Your Default Editor
Set Zed as your default editor for Git and other tools:- Bash:
~/.bashrc - Zsh:
~/.zshrc - Fish:
~/.config/fish/config.fish
--wait flag is essential for tools like Git that expect the editor to
block until editing is complete.
macOS: Release Channel Switching
On macOS, launch a specific release channel by prefixing the command:Exit Codes
| Code | Meaning |
|---|---|
0 | Success |
1 | Error (details printed to stderr) |
--wait, the exit code reflects the success of the editing session.
See Also
- Open Command - Detailed documentation on opening files and projects
- Diff Command - Comparing files with the
--diffflag - CLI Options - Complete reference for all CLI flags and options
