windows.md

 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-wasi
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
26## Backend dependencies
27
28> This section is still in development. The instructions are not yet complete.
29
30If you are developing collaborative features of Zed, you'll need to install the dependencies of zed's `collab` server:
31
32- Install [Postgres](https://www.postgresql.org/download/windows/)
33- Install [Livekit](https://github.com/livekit/livekit-cli) and [Foreman](https://theforeman.org/manuals/3.9/quickstart_guide.html)
34
35Alternatively, if you have [Docker](https://www.docker.com/) installed you can bring up all the `collab` dependencies using Docker Compose:
36
37```sh
38docker compose up -d
39```
40
41## Building from source
42
43Once you have the dependencies installed, you can build Zed using [Cargo](https://doc.rust-lang.org/cargo/).
44
45For a debug build:
46
47```sh
48cargo run
49```
50
51For a release build:
52
53```sh
54cargo run --release
55```
56
57And to run the tests:
58
59```sh
60cargo test --workspace
61```
62
63## Installing from msys2
64
65[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
66
67```sh
68pacman -Syu
69pacman -S mingw-w64-ucrt-x86_64-zed
70```
71
72then you can run `zed` in a UCRT64 shell.
73
74You can see the [build script](https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-zed/PKGBUILD) for more details.
75
76> Please, report any issue in [msys2/MINGW-packages/issues](https://github.com/msys2/MINGW-packages/issues?q=is%3Aissue+is%3Aopen+zed) first.
77
78## Troubleshooting
79
80### Can't compile zed
81
82Before reporting the issue, make sure that you have the latest rustc version with `rustup update`.
83
84### Cargo errors claiming that a dependency is using unstable features
85
86Try `cargo clean` and `cargo build`.
87
88### `STATUS_ACCESS_VIOLATION`
89
90This error can happen if you are using the "rust-lld.exe" linker. Consider trying a different linker.
91
92If 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.
93
94See this issue for more information [#12041](https://github.com/zed-industries/zed/issues/12041)