Building Zed for macOS
Clone the Repository
Clone the Zed repository:Install Dependencies
Rust
Install rustup:Xcode
Install Xcode from the macOS App Store or from the Apple Developer website. The Apple Developer download requires a developer account. Launch Xcode after installation and install the macOS components (the default option).Xcode Command Line Tools
Install the Xcode command line tools:CMake
Install CMake (required by a dependency):Build Zed from Source
Once you have the dependencies installed, you can build Zed using Cargo.Debug Build
For a debug build:Release Build
For a release build:Run Tests
To run the tests:Visual Regression Tests
Zed includes visual regression tests that capture screenshots of real Zed windows and compare them against baseline images. These tests require macOS with Screen Recording permission.Prerequisites
You must grant Screen Recording permission to your terminal:- Run the visual test runner once - macOS will prompt for permission
- Or manually: System Settings > Privacy & Security > Screen Recording
- Enable your terminal app (e.g., Terminal.app, iTerm2, Ghostty)
- Restart your terminal after granting permission
Running Visual Tests
Baseline Images
Baseline images are stored incrates/zed/test_fixtures/visual_tests/ but are gitignored to avoid bloating the repository. You must generate them locally before running tests.
Initial Setup
Before making any UI changes, generate baseline images from a known-good state:Updating Baselines
When UI changes are intentional, update the baseline images after your changes:In the future, baselines may be stored externally. For now, they remain local-only to keep the git repository lightweight.
Troubleshooting
Error compiling metal shaders
If you see:Cargo errors claiming that a dependency is using unstable features
Try:Error: ‘dispatch/dispatch.h’ file not found
If you encounter an error similar to:BINDGEN_EXTRA_CLANG_ARGS environment variable:
Tests failing due to “Too many open files (os error 24)”
This error seems to be caused by OS resource constraints. Installing and running tests withcargo-nextest should resolve the issue:
Tips & Tricks
Avoiding continual rebuilds
If Zed continually rebuilds root crates, you may be opening the Zed codebase itself in your development build. This causes problems becausecargo run exports a bunch of environment variables which are picked up by the rust-analyzer that runs in the development build of Zed. These environment variables are in turn passed to cargo check, which invalidates the build cache of some of the crates we depend on.
To avoid this, run the built binary against a different project:
Speeding up verification
If you build Zed frequently, macOS may keep verifying new builds, which can add a few seconds to each iteration. To fix this:- Run
sudo spctl developer-mode enable-terminalto enable the Developer Tools panel in System Settings - In System Settings, search for “Developer Tools” and add your terminal (e.g. iTerm or Ghostty) to the list under “Allow applications to use developer tools”
- Restart your terminal
