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 necessary system libraries:
20
21  ```bash
22  script/linux
23  ```
24
25  If you prefer to install the system libraries manually, you can find the list of required packages in the `script/linux` file.
26
27## Backend dependencies
28
29> [!WARNING]
30> This section is still in development. The instructions are not yet complete.
31
32If you are developing collaborative features of Zed, you'll need to install the dependencies of zed's `collab` server:
33
34- Install [Postgres](https://www.postgresql.org/download/linux/)
35- Install [Livekit](https://github.com/livekit/livekit-cli) and [Foreman](https://theforeman.org/manuals/3.9/quickstart_guide.html)
36
37Alternatively, if you have [Docker](https://www.docker.com/) installed you can bring up all the `collab` dependencies using Docker Compose:
38
39```sh
40docker compose up -d
41```
42
43## Building from source
44
45Once you have the dependencies installed, you can build Zed using [Cargo](https://doc.rust-lang.org/cargo/).
46
47For a debug build:
48
49```
50cargo run
51```
52
53For a release build:
54
55```
56cargo run --release
57```
58
59And to run the tests:
60
61```
62cargo test --workspace
63```
64
65## Wayland & X11
66
67Zed 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.
68
69## Troubleshooting
70
71### Can't compile zed
72
73Before reporting the issue, make sure that you have the latest rustc version with `rustup update`.
74
75### Cargo errors claiming that a dependency is using unstable features
76
77Try `cargo clean` and `cargo build`.
78
79### Vulkan/GPU issues
80
81If 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.
82
83If 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.