1# Environment Variables
2
3This page lists environment variables that affect Zed's behavior.
4
5## Where Zed Gets Environment Variables
6
7| Launch Method | Environment Source |
8|---------------|-------------------|
9| CLI (`zed .`) | Inherits from the shell session |
10| Dock / Launcher / Window Manager | Spawns a login shell in home directory |
11| Per-project | Spawns a login shell in the project directory |
12
13When launched via the CLI, Zed inherits environment variables from your shell. When launched from the Dock or a launcher, Zed spawns a login shell to obtain a base environment.
14
15For project-specific environments (e.g., when using `direnv`, `asdf`, or `mise`), Zed spawns an additional login shell in the project directory and stores those variables for use in tasks, terminals, and language servers.
16
17## Environment Variable Reference
18
19| Variable | Purpose |
20|----------|---------|
21| `XDG_CONFIG_HOME` | On Linux, overrides the default config location (`~/.config/zed`) |
22| `ZED_LOG_LEVEL` | Sets the log verbosity (`debug`, `info`, `warn`, `error`) |
23| `ZED_BUNDLE` | When set, indicates Zed is running as a bundled app |
24| `ZED_STATELESS` | When set, Zed won't persist window state between sessions |
25| `ZED_ALWAYS_ACTIVE` | When set, Zed behaves as if it's always the active application |
26| `http_proxy` / `HTTP_PROXY` | HTTP proxy URL for network requests |
27| `https_proxy` / `HTTPS_PROXY` | HTTPS proxy URL for network requests |
28| `no_proxy` / `NO_PROXY` | Comma-separated list of hosts to bypass proxy |
29
30## Variables Set by Zed
31
32Zed sets these variables in spawned processes (tasks, terminals, language servers):
33
34| Variable | Value |
35|----------|-------|
36| `ZED_TERM` | Set in the integrated terminal |
37| `TERM` | Set to a terminal type in the integrated terminal |
38| `EDITOR` | Set to `zed --wait` when appropriate |
39| `VISUAL` | Set to `zed --wait` when appropriate |
40
41## Usage in Tasks and Terminals
42
43Environment variables from your project are available in:
44
45- **Tasks**: All task commands have access to the project environment
46- **Terminal**: The integrated terminal inherits project-specific variables
47- **Language servers**: Servers spawned for a project use that project's environment
48
49```json
50{
51 "tasks": [
52 {
53 "label": "echo env",
54 "command": "echo $MY_PROJECT_VAR"
55 }
56 ]
57}
58```
59
60> **Note:** Environment handling changed in Zed 0.152.0. The CLI now always passes its environment to Zed, even when an instance is already running.