Skip to content

11 Windows / WSL(官方推荐路径)

结论

Windows 上优先用 WSL 跑 OpenCode(兼容性和性能更稳)。

安装

bash
curl -fsSL https://opencode.ai/install | bash

Desktop 连接 WSL Server

bash
OPENCODE_SERVER_PASSWORD=你的强密码 \
  opencode serve --hostname 0.0.0.0 --port 4096

Desktop 连接 http://localhost:4096

当监听 0.0.0.0 时必须设置 OPENCODE_SERVER_PASSWORD

建议

  • 仓库尽量放在 WSL 文件系统(如 ~/code/
  • 关键快捷键使用 <leader>...,降低终端冲突

参考

基于官方文档与 Schema 编写;示例不包含任何密钥