Skip to content

Install OpenCode in WSL on Windows

Install OpenCode inside WSL, connect a built-in model provider, keep projects and configuration in Linux, and fix common Windows and WSL issues.

MGMCSA Guru Team August 15, 2026 2 min read
OpenCode running inside WSL on Windows

Install OpenCode inside WSL when your repository and shell tools already live there. A native Windows installation and a WSL installation are separate, even on the same computer.

Install inside WSL

Open your Linux distribution and follow the current command on the OpenCode documentation site. Run the installer inside WSL, then open a new shell and confirm that OpenCode starts:

opencode --version

Use the current official installation method. Package names and installers can change between releases.

Keep the project in Linux

Create or clone the repository under your Linux home:

mkdir -p ~/projects
cd ~/projects
git clone https://example.com/your/repository.git
cd repository
opencode

Replace the example repository URL. Use /mnt/c only when Windows software needs direct access to the same files.

Connect a provider

Inside OpenCode, run:

/connect

Select the provider and enter its API key. Then choose a model:

/models

Built-in provider entries are the normal setup. For example, current OpenCode releases list DeepSeek directly, so a hand-written DeepSeek provider block is unnecessary.

Test the installation

Start with a read-only request such as listing files or summarizing a short document. Confirm the selected provider and model before allowing edits or commands.

Common problems

  • opencode is missing: install it inside the current WSL distribution and open a new shell.
  • A provider is missing: update OpenCode, restart it, and check /connect again.
  • A model is missing: run /models and use the exact current model entry.
  • File operations are slow: move the active repository from /mnt/c to the Linux home.
  • The Windows and WSL sessions differ: reconnect the provider in the environment you are using.

OpenCode in WSL checklist

  • OpenCode installed inside WSL
  • Repository kept in Linux when practical
  • Provider connected with /connect
  • Model selected with /models
  • Read-only request tested before edits

Frequently asked questions

Should I install OpenCode in WSL?

Install it in WSL when the repository and terminal toolchain already run there. The Linux and Windows OpenCode installations have separate commands, files, and credentials.

How do I connect a provider?

Start OpenCode, run /connect, select a built-in provider, and enter its API key. Then run /models to choose an available model.

Do I need a custom provider file for DeepSeek?

No. Current OpenCode releases list DeepSeek in the built-in provider menu. Use a custom provider only for an unlisted or organization-specific endpoint.

Where should the repository live?

Keep active repositories in the WSL Linux file system when practical. Frequent reads and writes are usually faster there than under /mnt/c.

Sources & further reading

Official vendor documentation referenced while writing this guide.

MG

MCSA Guru Team

IT & Systems Administration

We are working IT pros and system administrators who spend our days in Windows Server, Microsoft 365, and the wider Microsoft stack. MCSA Guru is where we write down the fixes and walkthroughs we wish we had found the first time.

MCSA Guru provides independent, educational IT guidance. Microsoft, Windows, Windows Server, Microsoft 365, Exchange, and Microsoft Teams are trademarks of Microsoft Corporation; Docker is a trademark of Docker, Inc. MCSA Guru is not affiliated with or endorsed by Microsoft or Docker. Always test changes in a safe environment before applying them in production.

Related guides

Fixing something right now?

Jump straight into the guide library or search for the exact error or task you are dealing with.