1# Building Zed for macOS
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, or from the [Apple Developer](https://developer.apple.com/download/all/) website. Note this requires a developer account.
15
16> Ensure you launch XCode after installing, and install the MacOS components, which is the default option.
17
18- Install [Xcode command line tools](https://developer.apple.com/xcode/resources/)
19
20 ```bash
21 xcode-select --install
22 ```
23
24- Ensure that the Xcode command line tools are using your newly installed copy of Xcode:
25
26 ```
27 sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
28 ```
29
30* Install the Rust wasm toolchain:
31
32 ```bash
33 rustup target add wasm32-wasi
34 ```
35
36## Backend Dependencies
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://postgresapp.com)
41- Install [Livekit](https://formulae.brew.sh/formula/livekit) and [Foreman](https://formulae.brew.sh/formula/foreman)
42
43 ```bash
44 brew install livekit foreman
45 ```
46
47Alternatively, if you have [Docker](https://www.docker.com/) installed you can bring up all the `collab` dependencies using Docker Compose:
48
49```sh
50docker compose up -d
51```
52
53## Building Zed from Source
54
55Once you have the dependencies installed, you can build Zed using [Cargo](https://doc.rust-lang.org/cargo/).
56
57For a debug build:
58
59```
60cargo run
61```
62
63For a release build:
64
65```
66cargo run --release
67```
68
69And to run the tests:
70
71```
72cargo test --workspace
73```
74
75## Troubleshooting
76
77### Error compiling metal shaders
78
79```
80error: failed to run custom build command for gpui v0.1.0 (/Users/path/to/zed)`**
81
82xcrun: error: unable to find utility "metal", not a developer tool or in PATH
83```
84
85Try `sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer`
86
87### Cargo errors claiming that a dependency is using unstable features
88
89Try `cargo clean` and `cargo build`.