Building Zed for Windows
The following commands may be executed in any shell.Clone the Repository
Clone the Zed repository:Install Dependencies
Rust
Install rustup.Visual Studio or Build Tools
Install either:- Visual Studio with the optional components:
MSVC v*** - VS YYYY C++ x64/x86 build toolsMSVC v*** - VS YYYY C++ x64/x86 Spectre-mitigated libs (latest)(wherev***is your VS version andYYYYis the release year. Adjust architecture as needed)
- Install only the Build Tools (plus the libs above) and the “Desktop development with C++” workload
This setup is not picked up automatically by rustup. Before compiling, initialize environment variables by launching the developer shell (cmd/PowerShell) installed in the Start menu or Windows Terminal.
Windows SDK
Install the Windows 11 or 10 SDK for your system, and make sure at leastWindows 10 SDK version 2104 (10.0.20348.0) is installed. You can download it from the Windows SDK Archive.
CMake
Install CMake (required by a dependency). You can also install it through Visual Studio Installer, then manually add thebin directory to your PATH, for example:
Verify Visual Studio Components
If you cannot compile Zed, make sure a Visual Studio installation includes at least the following components:- Open the Visual Studio Installer
- Click on
Morein theInstalledtab - Click on
Export configuration
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 are currently macOS-only and require Screen Recording permission. See Building Zed for macOS for details.
Troubleshooting
Setting RUSTFLAGS env var breaks builds
If you set the RUSTFLAGS env var, it will override the rustflags settings in .cargo/config.toml which is required to properly build Zed.
Because these settings change over time, the resulting build errors may vary from linker failures to other hard-to-diagnose errors.
If you need extra Rust flags, use one of the following approaches in .cargo/config.toml:
Add your flags in the build section
Add your flags in the windows target section
Create a parent .cargo/config.toml
Or, create a new .cargo/config.toml in the parent directory of the Zed repo. This is useful in CI because you do not need to edit the repo’s original .cargo/config.toml.
.cargo/config.toml, if we wanted to add --cfg gles to our rustflags, it would look like:
Cargo errors claiming that a dependency is using unstable features
Try:STATUS_ACCESS_VIOLATION
This error can happen if you are using the “rust-lld.exe” linker. Consider trying a different linker.
If you are using a global config, consider moving the Zed repository to a nested directory and add a .cargo/config.toml with a custom linker config in the parent directory.
See this issue for more information.
Invalid RC path selected
Sometimes, depending on the security rules applied to your laptop, you may get the following error while compiling Zed:ZED_RC_TOOLKIT_PATH environment variable to the RC toolkit path. Usually this is:
Build fails: Path too long
You may receive an error like the following when building:Graphics issues
Zed fails to launch
Zed currently uses Vulkan as its graphics API on Windows. If Zed fails to launch, Vulkan is a common cause. You can check the Zed log at:Zed failed to open a window: NoSupportedDeviceFoundERROR_INITIALIZATION_FAILEDGPU CrashedERROR_SURFACE_LOST_KHR
