developing_zed__building_zed.md

 1# Building Zed
 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)
14- Install [Xcode](https://apps.apple.com/us/app/xcode/id497799835?mt=12) from the macOS App Store
15
16- Install [Xcode command line tools](https://developer.apple.com/xcode/resources/)
17
18    ```bash
19    xcode-select --install
20    ```
21
22- Ensure that the Xcode command line tools are using your newly installed copy of Xcode:
23
24    ```
25    sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
26    ```
27
28* Install the Rust wasm toolchain:
29
30    ```bash
31    rustup target add wasm32-wasi
32    ```
33
34## Backend Dependencies
35
36If you are developing collaborative features of Zed, you'll need to install the dependencies of zed's `collab` server:
37
38- Install [Postgres](https://postgresapp.com)
39- Install [Livekit](https://formulae.brew.sh/formula/livekit) and [Foreman](https://formulae.brew.sh/formula/foreman)
40
41    ```bash
42    brew install livekit foreman
43    ```
44
45## Building Zed 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## Troubleshooting
68
69### Error compiling metal shaders
70
71```
72error: failed to run custom build command for gpui v0.1.0 (/Users/path/to/zed)`**
73
74xcrun: error: unable to find utility "metal", not a developer tool or in PATH
75```
76
77Try `xcode-select --switch /Applications/Xcode.app/Contents/Developer`
78
79### Cargo errors claiming that a dependency is using unstable features
80
81Try `cargo clean` and `cargo build`,