1# Zed on Linux
2
3For most people we recommend using the script on the [download](https://zed.dev/download) page to install Zed:
4
5```sh
6curl -f https://zed.dev/install.sh | sh
7```
8
9We also offer a preview build of Zed which receives updates about a week ahead of stable. You can install it with:
10
11```sh
12curl -f https://zed.dev/install.sh | ZED_CHANNEL=preview sh
13```
14
15The Zed installed by the script works best on systems that:
16
17- have a Vulkan compatible GPU available (for example Linux on an M-series macBook)
18- have a system-wide glibc (NixOS and Alpine do not by default)
19 - x86_64 (Intel/AMD): glibc version >= 2.31 (Ubuntu 20 and newer)
20 - aarch64 (ARM): glibc version >= 2.35 (Ubuntu 22 and newer)
21
22Both Nix and Alpine have third-party Zed packages available (though they are currently a few weeks out of date). If you'd like to use our builds they do work if you install a glibc compatibility layer. On NixOS you can try [nix-ld](https://github.com/Mic92/nix-ld), and on Alpine [gcompat](https://wiki.alpinelinux.org/wiki/Running_glibc_programs).
23
24You will need to build from source for:
25
26- architectures other than 64-bit Intel or 64-bit ARM (for example a 32-bit or RISC-V machine)
27- Redhat Enterprise Linux 8.x, Rocky Linux 8, AlmaLinux 8, Amazon Linux 2 on all architectures
28- Redhat Enterprise Linux 9.x, Rocky Linux 9.3, AlmaLinux 8, Amazon Linux 2023 on aarch64 (x86_x64 OK)
29
30## Other ways to install Zed on Linux
31
32Zed is open source, and [you can install from source](./development/linux.md).
33
34### Installing via a package manager
35
36There are several third-party Zed packages for various Linux distributions and package managers, sometimes under `zed-editor`. You may be able to install Zed using these packages:
37
38- Flathub: [`dev.zed.Zed`](https://flathub.org/apps/dev.zed.Zed)
39- Arch: [`zed`](https://archlinux.org/packages/extra/x86_64/zed/)
40- Arch (AUR): [`zed-git`](https://aur.archlinux.org/packages/zed-git), [`zed-preview`](https://aur.archlinux.org/packages/zed-preview), [`zed-preview-bin`](https://aur.archlinux.org/packages/zed-preview-bin)
41- Alpine: `zed` ([aarch64](https://pkgs.alpinelinux.org/package/edge/testing/aarch64/zed)) ([x86_64](https://pkgs.alpinelinux.org/package/edge/testing/x86_64/zed))
42- Nix: `zed-editor` ([unstable](https://search.nixos.org/packages?channel=unstable&show=zed-editor))
43- Fedora/Ultramarine (Terra): [`zed`](https://github.com/terrapkg/packages/tree/frawhide/anda/devs/zed/stable), [`zed-preview`](https://github.com/terrapkg/packages/tree/frawhide/anda/devs/zed/preview), [`zed-nightly`](https://github.com/terrapkg/packages/tree/frawhide/anda/devs/zed/nightly)
44- Solus: [`zed`](https://github.com/getsolus/packages/tree/main/packages/z/zed)
45- Parabola: [`zed`](https://www.parabola.nu/packages/extra/x86_64/zed/)
46- Manjaro: [`zed`](https://packages.manjaro.org/?query=zed)
47- ALT Linux (Sisyphus): [`zed`](https://packages.altlinux.org/en/sisyphus/srpms/zed/)
48- AOSC OS: [`zed`](https://packages.aosc.io/packages/zed)
49- openSUSE Tumbleweed: [`zed`](https://en.opensuse.org/Zed)
50- Please add others to this list!
51
52When installing a third-party package please be aware that it may not be completely up to date and may be slightly different from the Zed we package (a common change is to rename the binary to `zedit` or `zeditor` to avoid conflicting with other packages).
53
54We'd love your help making Zed available for everyone. If Zed is not yet available for your package manager, and you would like to fix that, we have some notes on [how to do it](./development/linux.md#notes-for-packaging-zed).
55
56### Downloading manually
57
58If you'd prefer, you can install Zed by downloading our pre-built .tar.gz. This is the same artifact that our install script uses, but you can customize the location of your installation by modifying the instructions below:
59
60Download the `.tar.gz` file:
61
62- [zed-linux-x86_64.tar.gz](https://zed.dev/api/releases/stable/latest/zed-linux-x86_64.tar.gz) ([preview](https://zed.dev/api/releases/preview/latest/zed-linux-x86_64.tar.gz))
63- [zed-linux-aarch64.tar.gz](https://zed.dev/api/releases/stable/latest/zed-linux-aarch64.tar.gz)
64 ([preview](https://zed.dev/api/releases/preview/latest/zed-linux-aarch64.tar.gz))
65
66Then ensure that the `zed` binary in the tarball is on your path. The easiest way is to unpack the tarball and create a symlink:
67
68```sh
69mkdir -p ~/.local
70# extract zed to ~/.local/zed.app/
71tar -xvf <path/to/download>.tar.gz -C ~/.local
72# link the zed binary to ~/.local/bin (or another directory in your $PATH)
73ln -sf ~/.local/zed.app/bin/zed ~/.local/bin/zed
74```
75
76If you'd like integration with an XDG-compatible desktop environment, you will also need to install the `.desktop` file:
77
78```sh
79cp ~/.local/zed.app/share/applications/zed.desktop ~/.local/share/applications/dev.zed.Zed.desktop
80sed -i "s|Icon=zed|Icon=$HOME/.local/zed.app/share/icons/hicolor/512x512/apps/zed.png|g" ~/.local/share/applications/dev.zed.Zed.desktop
81sed -i "s|Exec=zed|Exec=$HOME/.local/zed.app/libexec/zed-editor|g" ~/.local/share/applications/dev.zed.Zed.desktop
82```
83
84## Troubleshooting
85
86Linux works on a large variety of systems configured in many different ways. We primarily test Zed on a vanilla Ubuntu setup, as it is the most common distribution our users use, that said we do expect it to work on a wide variety of machines.
87
88### Zed fails to start
89
90If you see an error like "/lib64/libc.so.6: version 'GLIBC_2.29' not found" it means that your distribution's version of glibc is too old. You can either upgrade your system, or [install Zed from source](./development/linux.md).
91
92### Graphics issues
93
94### Zed fails to open windows
95
96Zed requires a GPU to run effectively. Under the hood, we use [Vulkan](https://www.vulkan.org/) to communicate with your GPU. If you are seeing problems with performance, or Zed fails to load, it is possible that Vulkan is the culprit.
97
98If you see a notification saying `Zed failed to open a window: NoSupportedDeviceFound` this means that Vulkan cannot find a compatible GPU. You can begin troubleshooting Vulkan by installing the `vulkan-tools` package and running:
99
100```sh
101vkcube
102```
103
104This should output a line describing your current graphics setup and show a rotating cube. If this does not work, you should be able to fix it by installing Vulkan compatible GPU drivers, however in some cases (for example running Linux on an Arm-based MacBook) there is no Vulkan support yet.
105
106You can find out which graphics card Zed is using by looking in the Zed log (`~/.local/share/zed/logs/Zed.log`) for `Using GPU: ...`.
107
108If you see errors like `ERROR_INITIALIZATION_FAILED` or `GPU Crashed` or `ERROR_SURFACE_LOST_KHR` then you may be able to work around this by installing different drivers for your GPU, or by selecting a different GPU to run on. (See [#14225](https://github.com/zed-industries/zed/issues/14225))
109
110On some systems the file `/etc/prime-discrete` can be used to enforce the use of a discrete GPU using [PRIME](https://wiki.archlinux.org/title/PRIME). Depending on the details of your setup, you may need to change the contents of this file to "on" (to force discrete graphics) or "off" (to force integrated graphics).
111
112On others, you may be able to the environment variable `DRI_PRIME=1` when running Zed to force the use of the discrete GPU.
113
114If you're using an AMD GPU and Zed crashes when selecting long lines, try setting the `ZED_PATH_SAMPLE_COUNT=0` environment variable. (See [#26143](https://github.com/zed-industries/zed/issues/26143))
115If you're using an AMD GPU, you might get a 'Broken Pipe' error. Try using the RADV or Mesa drivers. (See [#13880](https://github.com/zed-industries/zed/issues/13880))
116
117If you are using Mesa, and want more control over which GPU is selected you can run `MESA_VK_DEVICE_SELECT=list zed --foreground` to get a list of available GPUs and then export `MESA_VK_DEVICE_SELECT=xxxx:yyyy` to choose a specific device.
118
119If you are using `amdvlk` you may find that zed only opens when run with `sudo $(which zed)`. To fix this, remove the `amdvlk` and `lib32-amdvlk` packages and install mesa/vulkan instead. ([#14141](https://github.com/zed-industries/zed/issues/14141)).
120
121For more information, the [Arch guide to Vulkan](https://wiki.archlinux.org/title/Vulkan) has some good steps that translate well to most distributions.
122
123If Vulkan is configured correctly, and Zed is still not working for you, please [file an issue](https://github.com/zed-industries/zed) with as much information as possible.
124
125### I can't open any files
126
127### Clicking links isn't working
128
129These features are provided by XDG desktop portals, specifically:
130
131- `org.freedesktop.portal.FileChooser`
132- `org.freedesktop.portal.OpenURI`
133
134Some window managers, such as `Hyprland`, don't provide a file picker by default. See [this list](https://wiki.archlinux.org/title/XDG_Desktop_Portal#List_of_backends_and_interfaces) as a starting point for alternatives.
135
136### Zed isn't remembering my API keys
137
138### Zed isn't remembering my login
139
140These feature also requires XDG desktop portals, specifically:
141
142- `org.freedesktop.portal.Secret` or
143- `org.freedesktop.Secrets`
144
145Zed needs a place to securely store secrets such as your Zed login cookie or your OpenAI API Keys and we use a system provided keychain to do this. Examples of packages that provide this are `gnome-keyring`, `KWallet` and `keepassxc` among others.
146
147### Could not start inotify
148
149Zed relies on inotify to watch your filesystem for changes. If you cannot start inotify then Zed will not work reliably.
150
151If you are seeing "too many open files" then first try `sysctl fs.inotify`.
152
153- You should see that max_user_instances is 128 or higher (you can change the limit with `sudo sysctl fs.inotify.max_user_instances=1024`). Zed needs only 1 inotify instance.
154- You should see that `max_user_watches` is 8000 or higher (you can change the limit with `sudo sysctl fs.inotify.max_user_watches=64000`). Zed needs one watch per directory in all your open projects + one per git repository + a handful more for settings, themes, keymaps, extensions.
155
156It is also possible that you are running out of file descriptors. You can check the limits with `ulimit` and update them by editing `/etc/security/limits.conf`.
157
158### No sound or wrong output device
159
160If you're not hearing any sound in Zed or the audio is routed to the wrong device, it could be due to a mismatch between audio systems. Zed relies on ALSA, while your system may be using PipeWire or PulseAudio. To resolve this, you need to configure ALSA to route audio through PipeWire/PulseAudio.
161
162If your system uses PipeWire:
163
1641. **Install the PipeWire ALSA plugin**
165
166 On Debian-based systems, run:
167
168 ```bash
169 sudo apt install pipewire-alsa
170 ```
171
1722. **Configure ALSA to use PipeWire**
173
174 Add the following configuration to your ALSA settings file. You can use either `~/.asoundrc` (user-level) or `/etc/asound.conf` (system-wide):
175
176 ```bash
177 pcm.!default {
178 type pipewire
179 }
180
181 ctl.!default {
182 type pipewire
183 }
184 ```
185
1863. **Restart your system**