Skip to content

Commit 2c82e6c

Browse files
authored
docs: prefer wsl over native windows stuff (#11637)
1 parent 3577d82 commit 2c82e6c

5 files changed

Lines changed: 128 additions & 0 deletions

File tree

packages/web/astro.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export default defineConfig({
8585
"network",
8686
"enterprise",
8787
"troubleshooting",
88+
"windows-wsl",
8889
"1-0",
8990
{
9091
label: "Usage",

packages/web/src/content/docs/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ You can also install it with the following commands:
8989

9090
#### Windows
9191

92+
:::tip[Recommended: Use WSL]
93+
For the best experience on Windows, we recommend using [Windows Subsystem for Linux (WSL)](/docs/windows-wsl). It provides better performance and full compatibility with OpenCode's features.
94+
:::
95+
9296
- **Using Chocolatey**
9397

9498
```bash

packages/web/src/content/docs/troubleshooting.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ On Windows, OpenCode Desktop requires the Microsoft Edge **WebView2 Runtime**. I
136136

137137
---
138138

139+
### Windows: General performance issues
140+
141+
If you're experiencing slow performance, file access issues, or terminal problems on Windows, try using [WSL (Windows Subsystem for Linux)](/docs/windows-wsl). WSL provides a Linux environment that works more seamlessly with OpenCode's features.
142+
143+
---
144+
139145
### Notifications not showing
140146

141147
OpenCode Desktop only shows system notifications when:

packages/web/src/content/docs/web.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ This starts a local server on `127.0.0.1` with a random available port and autom
2121
If `OPENCODE_SERVER_PASSWORD` is not set, the server will be unsecured. This is fine for local use but should be set for network access.
2222
:::
2323

24+
:::tip[Windows Users]
25+
For the best experience, run `opencode web` from [WSL](/docs/windows-wsl) rather than PowerShell. This ensures proper file system access and terminal integration.
26+
:::
27+
2428
---
2529

2630
## Configuration
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
title: Windows (WSL)
3+
description: Run OpenCode on Windows using WSL for the best experience.
4+
---
5+
6+
import { Steps } from "@astrojs/starlight/components"
7+
8+
While OpenCode can run directly on Windows, we recommend using [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/install) for the best experience. WSL provides a Linux environment that works seamlessly with OpenCode's features.
9+
10+
:::tip[Why WSL?]
11+
WSL offers better file system performance, full terminal support, and compatibility with development tools that OpenCode relies on.
12+
:::
13+
14+
---
15+
16+
## Setup
17+
18+
<Steps>
19+
20+
1. **Install WSL**
21+
22+
If you haven't already, [install WSL](https://learn.microsoft.com/en-us/windows/wsl/install) using the official Microsoft guide.
23+
24+
2. **Install OpenCode in WSL**
25+
26+
Once WSL is set up, open your WSL terminal and install OpenCode using one of the [installation methods](/docs/).
27+
28+
```bash
29+
curl -fsSL https://opencode.ai/install | bash
30+
```
31+
32+
3. **Use OpenCode from WSL**
33+
34+
Navigate to your project directory (access Windows files via `/mnt/c/`, `/mnt/d/`, etc.) and run OpenCode.
35+
36+
```bash
37+
cd /mnt/c/Users/YourName/project
38+
opencode
39+
```
40+
41+
</Steps>
42+
43+
---
44+
45+
## Desktop App + WSL Server
46+
47+
If you prefer using the OpenCode Desktop app but want to run the server in WSL:
48+
49+
1. **Start the server in WSL** with `--hostname 0.0.0.0` to allow external connections:
50+
51+
```bash
52+
opencode serve --hostname 0.0.0.0 --port 4096
53+
```
54+
55+
2. **Connect the Desktop app** to `http://localhost:4096`
56+
57+
:::note
58+
If `localhost` does not work in your setup, connect using the WSL IP address instead (from WSL: `hostname -I`) and use `http://<wsl-ip>:4096`.
59+
:::
60+
61+
:::caution
62+
When using `--hostname 0.0.0.0`, set `OPENCODE_SERVER_PASSWORD` to secure the server.
63+
64+
```bash
65+
OPENCODE_SERVER_PASSWORD=your-password opencode serve --hostname 0.0.0.0
66+
```
67+
68+
:::
69+
70+
---
71+
72+
## Web Client + WSL
73+
74+
For the best web experience on Windows:
75+
76+
1. **Run `opencode web` in the WSL terminal** rather than PowerShell:
77+
78+
```bash
79+
opencode web --hostname 0.0.0.0
80+
```
81+
82+
2. **Access from your Windows browser** at `http://localhost:<port>` (OpenCode prints the URL)
83+
84+
Running `opencode web` from WSL ensures proper file system access and terminal integration while still being accessible from your Windows browser.
85+
86+
---
87+
88+
## Accessing Windows Files
89+
90+
WSL can access all your Windows files through the `/mnt/` directory:
91+
92+
- `C:` drive → `/mnt/c/`
93+
- `D:` drive → `/mnt/d/`
94+
- And so on...
95+
96+
Example:
97+
98+
```bash
99+
cd /mnt/c/Users/YourName/Documents/project
100+
opencode
101+
```
102+
103+
:::tip
104+
For the smoothest experience, consider cloning/copying your repo into the WSL filesystem (for example under `~/code/`) and running OpenCode there.
105+
:::
106+
107+
---
108+
109+
## Tips
110+
111+
- Keep OpenCode running in WSL for projects stored on Windows drives - file access is seamless
112+
- Use VS Code's [WSL extension](https://code.visualstudio.com/docs/remote/wsl) alongside OpenCode for an integrated development workflow
113+
- Your OpenCode config and sessions are stored within the WSL environment at `~/.local/share/opencode/`

0 commit comments

Comments
 (0)