1# Building Zed for Windows
2
3> The following commands may be executed in any shell.
4
5## Repository
6
7Clone down the [Zed repository](https://github.com/zed-industries/zed).
8
9## Dependencies
10
11- Install [Rust](https://www.rust-lang.org/tools/install). If it's already installed, make sure it's up-to-date:
12
13 ```sh
14 rustup update
15 ```
16
17- Install the Rust wasm toolchain:
18
19 ```sh
20 rustup target add wasm32-wasip1
21 ```
22
23- Install [Visual Studio](https://visualstudio.microsoft.com/downloads/) with the optional component `MSVC v*** - VS YYYY C++ x64/x86 build tools` (`v***` is your VS version and `YYYY` is year when your VS was released)
24- Install Windows 11 or 10 SDK depending on your system, but ensure that at least `Windows 10 SDK version 2104 (10.0.20348.0)` is installed on your machine. You can download it from the [Windows SDK Archive](https://developer.microsoft.com/windows/downloads/windows-sdk/)
25- Install [CMake](https://cmake.org/download)
26
27## Backend dependencies
28
29> This section is still in development. The instructions are not yet complete.
30
31If you are developing collaborative features of Zed, you'll need to install the dependencies of zed's `collab` server:
32
33- Install [Postgres](https://www.postgresql.org/download/windows/)
34- Install [Livekit](https://github.com/livekit/livekit-cli) and [Foreman](https://theforeman.org/manuals/3.9/quickstart_guide.html)
35
36Alternatively, if you have [Docker](https://www.docker.com/) installed you can bring up all the `collab` dependencies using Docker Compose:
37
38```sh
39docker compose up -d
40```
41
42## Building from source
43
44Once you have the dependencies installed, you can build Zed using [Cargo](https://doc.rust-lang.org/cargo/).
45
46For a debug build:
47
48```sh
49cargo run
50```
51
52For a release build:
53
54```sh
55cargo run --release
56```
57
58And to run the tests:
59
60```sh
61cargo test --workspace
62```
63
64## Installing from msys2
65
66[MSYS2](https://msys2.org/) distribution provides Zed as a package [mingw-w64-zed](https://packages.msys2.org/base/mingw-w64-zed). To download the prebuilt binary, run
67
68```sh
69pacman -Syu
70pacman -S mingw-w64-ucrt-x86_64-zed
71```
72
73then you can run `zed` in a UCRT64 shell.
74
75You can see the [build script](https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-zed/PKGBUILD) for more details.
76
77> Please, report any issue in [msys2/MINGW-packages/issues](https://github.com/msys2/MINGW-packages/issues?q=is%3Aissue+is%3Aopen+zed) first.
78
79## Troubleshooting
80
81### Can't compile zed
82
83Before reporting the issue, make sure that you have the latest rustc version with `rustup update`.
84
85### Cargo errors claiming that a dependency is using unstable features
86
87Try `cargo clean` and `cargo build`.
88
89### `STATUS_ACCESS_VIOLATION`
90
91This error can happen if you are using the "rust-lld.exe" linker. Consider trying a different linker.
92
93If 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.
94
95See this issue for more information [#12041](https://github.com/zed-industries/zed/issues/12041)