developing_zed__building_zed_linux.md

 1# Building Zed for Linux
 2
 3## Repository
 4
 5After cloning the repository, ensure all git submodules are initialized:
 6
 7```shell
 8git submodule update --init --recursive
 9```
10
11## Dependencies
12
13- Install [Rust](https://www.rust-lang.org/tools/install). If it's already installed, make sure it's up-to-date:
14
15  ```bash
16  rustup update
17  ```
18
19- Install the Rust wasm toolchain:
20
21  ```bash
22  rustup target add wasm32-wasi
23  ```
24
25- Install the necessary system libraries:
26
27  ```bash
28  script/linux
29  ```
30
31  If you prefer to install the system libraries manually, you can find the list of required packages in the `script/linux` file.
32
33## Backend dependencies
34
35> [!WARNING]
36> This section is still in development. The instructions are not yet complete.
37
38If you are developing collaborative features of Zed, you'll need to install the dependencies of zed's `collab` server:
39
40- Install [Postgres](https://www.postgresql.org/download/linux/)
41- Install [Livekit](https://github.com/livekit/livekit-cli) and [Foreman](https://theforeman.org/manuals/3.9/quickstart_guide.html)
42
43Alternatively, if you have [Docker](https://www.docker.com/) installed you can bring up all the `collab` dependencies using Docker Compose:
44
45```sh
46docker compose up -d
47```
48
49## Building from source
50
51Once you have the dependencies installed, you can build Zed using [Cargo](https://doc.rust-lang.org/cargo/).
52
53For a debug build:
54
55```
56cargo run
57```
58
59For a release build:
60
61```
62cargo run --release
63```
64
65And to run the tests:
66
67```
68cargo test --workspace
69```
70
71## Wayland & X11
72
73Zed has basic support for both modes. The mode is selected at runtime. If you're on wayland and want to run in X11 mode, you can set `WAYLAND_DISPLAY='' cargo run` to do so.
74
75## Troubleshooting
76
77### Can't compile zed
78
79Before reporting the issue, make sure that you have the latest rustc version with `rustup update`.
80
81### Cargo errors claiming that a dependency is using unstable features
82
83Try `cargo clean` and `cargo build`.
84
85### Vulkan/GPU issues
86
87If Zed crashes at runtime due to GPU or vulkan issues, you can try running [vkcube](https://github.com/krh/vkcube) (usually available as part of the `vulkaninfo` package on various distributions) to try to troubleshoot where the issue is coming from. Try running in both X11 and wayland modes by running `vkcube -m [x11|wayland]`. Some versions of `vkcube` use `vkcube` to run in X11 and `vkcube-wayland` to run in wayland.
88
89If you have multiple GPUs, you can also try running Zed on a different one (for example, with [vkdevicechooser](https://github.com/jiriks74/vkdevicechooser)) to figure out where the issue comes from.