windows.md

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