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 -Syu
73pacman -S mingw-w64-ucrt-x86_64-zed
74```
75
76then you can run `zed` in a UCRT64 shell.
77
78> [!NOTE]
79> Please, report any issue in https://github.com/msys2/MINGW-packages/issues first.
80
81## Troubleshooting
82
83### Can't compile zed
84
85Before reporting the issue, make sure that you have the latest rustc version with `rustup update`.
86
87### Cargo errors claiming that a dependency is using unstable features
88
89Try `cargo clean` and `cargo build`.
90
91### `STATUS_ACCESS_VIOLATION`
92
93This error can happen if you are using the "rust-lld.exe" linker. Consider trying a different linker.
94
95If 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.
96
97See this issue for more information [#12041](https://github.com/zed-industries/zed/issues/12041)