OpenCode on Windows: install with WSL, Scoop, npm or the OpenCode 2 binary, with a failing PowerShell install command next to the same command succeeding in WSL
All articles

Install OpenCode on Windows: PowerShell, WSL and fixes

Install OpenCode on Windows from PowerShell with Scoop, Chocolatey or npm, or in WSL with the install script, then fix the curl error, PATH and other issues.

OpenCode runs on Windows, but the first attempt often goes wrong: the one-line install command from the docs fails in PowerShell, or the install finishes and Windows says opencode is not recognized. This guide covers the routes that work as of October 2026, based on the official OpenCode install docs: WSL (the route the docs recommend), native package managers, and the standalone binary for OpenCode 2. It then fixes the errors people hit most often.

Your agents, in one office.Every task gets a desk and a live status card. Click a desk to focus it.Try VibeiDE free

How do I install OpenCode on Windows with PowerShell?

In PowerShell, install OpenCode with one Windows package manager: scoop install opencode, choco install opencode or npm install -g opencode-ai. Then open a new PowerShell window and run opencode --version. The one-line curl ... | bash script from the docs does not work in PowerShell; it is meant for WSL, macOS and Linux.

# pick ONE of these
scoop install opencode
choco install opencode
npm install -g opencode-ai

# then, in a new PowerShell window
opencode --version

As of October 2026 the docs list no PowerShell install script, so a package manager is the native route. The rest of this guide explains when WSL is the better choice and how to fix the usual errors.

Pick a route first

There are three sensible ways to run OpenCode on a Windows machine. They all end with the same opencode command, but they behave differently.

Three install routes for Windows (WSL with the install script, a native package manager such as Scoop, Chocolatey or npm, and the OpenCode 2 standalone binary) each lighting up in turn and joining one opencode command
All three routes give you the same opencode command. Pick one, because two installs on PATH can run a version you did not expect.
RouteCommandBest for
WSL (recommended)curl -fsSL https://opencode.ai/install | bash inside WSLBest file system performance and full terminal support
Scoopscoop install opencodeNative Windows, OpenCode 1
Chocolateychoco install opencodeNative Windows, OpenCode 1
npmnpm install -g opencode-aiMachines that already have Node.js
misemise use -g github:anomalyco/opencodePeople who manage tools with mise
Dockerdocker run -it --rm ghcr.io/anomalyco/opencodeA throwaway, isolated run
OpenCode 2 binaryDownload the Windows zip from the V2 docsTrying OpenCode 2 natively

The docs say plainly that WSL gives better performance and full compatibility with OpenCode's features, so start there unless you have a reason not to. They also note that installing on Windows with Bun is still in progress, so skip Bun for now.

Install OpenCode in WSL

If WSL is not set up yet, install it with Microsoft's guide and open your Linux distribution's terminal. Everything below runs inside that WSL shell, not in PowerShell.

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

Then open a project. Your Windows drives are mounted under /mnt/, so C: is /mnt/c/:

cd /mnt/c/Users/YourName/projects/my-app
opencode

That works, but the OpenCode WSL guide recommends a faster setup: clone or copy the repository into the WSL file system, for example under ~/code/, and run OpenCode there. File access across the /mnt/c boundary is slower than inside WSL, and a coding agent reads a lot of files.

mkdir -p ~/code && cd ~/code
git clone https://github.com/your-org/my-app.git
cd my-app
opencode

Inside the terminal UI, run /connect to add a model provider, then /init so OpenCode writes an AGENTS.md file for the project. Our OpenCode install guide walks through those first steps and the CLI commands in detail. If you want to start without paying for a model, see OpenCode free models and OpenRouter free models.

Note that OpenCode's config and sessions live inside WSL, in ~/.local/share/opencode/. A native Windows install and a WSL install do not share sessions or credentials, so pick one and stay with it.

Install OpenCode natively on Windows

If you would rather stay in PowerShell or Windows Terminal, OpenCode 1 is available through the usual Windows package managers:

scoop install opencode
choco install opencode
npm install -g opencode-ai

Use one of them, not all three. Each one installs its own copy of the opencode binary, and two copies on your path is a reliable way to end up running a version you did not expect. Precompiled OpenCode 1 binaries are also published on the project's GitHub releases page if you prefer to manage the file yourself.

OpenCode 2 on Windows

OpenCode 2 is a separate release line. As of October 2026 its docs offer Windows standalone binaries (x64, x64 baseline for older CPUs, and ARM64) and state that Windows package managers are not supported for OpenCode 2. Two rules from the migration guide matter here:

  • OpenCode 1 and OpenCode 2 both use the opencode command and cannot be installed side by side under the default name.
  • Remove a package-managed OpenCode 1 install before you install OpenCode 2, otherwise the old binary may still win on your path.

So on Windows, choose: OpenCode 1 through Scoop, Chocolatey or npm, or OpenCode 2 from the standalone zip. OpenCode 2 reads your existing config from the same locations as OpenCode 1, so you do not have to rewrite it to try the new version.

Why the curl install command fails in PowerShell

The most common Windows error starts with the install line from the docs:

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

In Windows PowerShell 5.1, curl is an alias for Invoke-WebRequest, a different command with different parameters. It does not understand -fsSL, so you get "A parameter cannot be found that matches parameter name 'fsSL'". Even if the download worked, Windows has no bash to pipe it into, which produces "bash is not recognized".

Side by side: the curl pipe to bash install command fails in Windows PowerShell because curl means Invoke-WebRequest and bash is missing, while the same command succeeds in a WSL terminal and opencode --version prints the version
The install script is for macOS, Linux and WSL. In Windows PowerShell, curl is an alias for Invoke-WebRequest and there is no bash to run the script.

The fix is not to translate the command. The script is for macOS, Linux and WSL. Either run it inside a WSL terminal, or use one of the native routes above.

Fix "opencode is not recognized"

If the install reported success but opencode is still not found, check these in order:

  1. Open a new terminal. Installers change PATH, and an already open window keeps the old value.
  2. Find out where the binary is. Run where.exe opencode in PowerShell. No result means the folder is not on PATH.
  3. For npm installs, check the npm prefix. Run npm prefix -g. On Windows, npm puts global commands directly in that folder (by default %AppData%\npm), and that folder must be on your user PATH.
  4. Look for duplicates. If where.exe opencode lists two paths, uninstall the one you do not use.
  5. Check you are in the right shell. A WSL install is only visible inside WSL, and a Scoop install is only visible in Windows shells.

Use the desktop app or web UI with WSL

You can keep OpenCode running in WSL and still use a Windows window to drive it. The WSL guide describes two ways. If you have not installed the desktop app yet, our OpenCode desktop app guide lists the Windows installers and the other GUI options.

The OpenCode desktop app or browser on Windows connecting to opencode serve running inside WSL on port 4096, with a prompt flowing in and files, diffs and output flowing back, plus a reminder to set OPENCODE_SERVER_PASSWORD
Keep the agent and the repository in WSL, and drive it from a Windows window through opencode serve or opencode web. Set a server password when binding to 0.0.0.0.

For the desktop app, start a server in WSL that accepts outside connections, then point the app at it:

OPENCODE_SERVER_PASSWORD=choose-a-password opencode serve --hostname 0.0.0.0 --port 4096

Connect the desktop app to http://localhost:4096. If localhost does not work, run hostname -I in WSL and use that IP address instead. Always set OPENCODE_SERVER_PASSWORD when you bind to 0.0.0.0, because that address listens on every network interface.

For the browser, run opencode web --hostname 0.0.0.0 in the WSL terminal and open the URL it prints in your Windows browser. File access and terminal integration keep working because the agent itself still runs inside WSL.

If the desktop app opens to a blank window or will not start, install or update the Microsoft Edge WebView2 Runtime, which the troubleshooting page lists as a requirement.

Where OpenCode keeps its files on Windows

When something breaks, you usually need one of these folders. For a native install they are under your user profile. Paste them into the Run dialog (Win+R):

WhatNative Windows path
Logs (10 most recent)%USERPROFILE%\.local\share\opencode\log
Credentials and session data%USERPROFILE%\.local\share\opencode
Global config%USERPROFILE%\.config\opencode\opencode.jsonc
Global plugins%USERPROFILE%\.config\opencode\plugins
Provider package cache%USERPROFILE%\.cache\opencode
Desktop app storage%APPDATA%

The credentials file, auth.json, holds your API keys and tokens. Never commit or share it.

Fix the other common errors

These come from the official troubleshooting page for OpenCode 1:

SymptomWhat to try
OpenCode will not startCheck the logs, run opencode --print-logs, and update with opencode upgrade
You need more detailRun opencode --log-level DEBUG and reproduce the problem
ProviderInitErrorUsually a bad or corrupted config. Check the provider setup, delete %USERPROFILE%\.local\share\opencode, then run /connect again
AI_APICallError or provider package errorsDelete %USERPROFILE%\.cache\opencode and restart so the packages reinstall
Model not availableConfirm you are signed in and use the provider/model format, then check opencode models
Desktop app crashes or hangsSet "plugin": [] in the global config and re-enable plugins one at a time
Slow file access or terminal glitchesMove the project into WSL and run OpenCode there

Deleting the data folder removes stored credentials and local session data, so treat it as a last resort and copy anything you want to keep first. Our guide to OpenCode models explains provider and model IDs if the model error persists.

Running OpenCode next to Codex and Claude Code

Many Windows developers use OpenCode alongside other agents. If you also run Codex, our guide to installing the Codex CLI covers its Windows setup, and OpenCode vs Codex compares the two. VibeiDE is a desktop app that coordinates the Codex, Claude Code and OpenCode CLIs you already installed; Windows is supported, macOS is fully validated, and OpenCode runs headless there with its activity recorded per task. Each project gets its own task queue, and finished work waits in Ready for review. See the OpenCode page or download VibeiDE for a 14-day trial that starts at first sign-in, without a card.

Common questions

How do I install OpenCode on Windows with PowerShell?

Run one of scoop install opencode, choco install opencode or npm install -g opencode-ai in PowerShell, open a new window and check opencode --version. Do not paste the curl ... | bash script into PowerShell.

Does OpenCode work on Windows without WSL?

Yes. Scoop, Chocolatey, npm, mise and Docker all install OpenCode 1 natively, and OpenCode 2 has a Windows standalone binary. The docs still recommend WSL for performance and full feature compatibility.

Can I run the curl install command in PowerShell?

No. In Windows PowerShell, curl is an alias for Invoke-WebRequest and there is no bash to run the script. Run that command inside WSL, or use a Windows package manager instead.

Should I install OpenCode 1 or OpenCode 2?

Both use the opencode command and cannot share it, so pick one. OpenCode 1 has the most install options on Windows today. OpenCode 2 ships a standalone Windows binary and reads your existing OpenCode 1 config.

Where are OpenCode logs on Windows?

In %USERPROFILE%\.local\share\opencode\log for a native install, or in ~/.local/share/opencode/log/ inside WSL.

Takeaways

  • In PowerShell, install with exactly one of Scoop, Chocolatey or npm, then open a new window.
  • Run OpenCode in WSL if you can; keep the repository inside the WSL file system for speed.
  • The curl ... | bash installer is for WSL, macOS and Linux, not PowerShell.
  • OpenCode 1 and 2 share the opencode command; remove a package-managed OpenCode 1 before installing 2.
  • "Not recognized" is a PATH problem: open a new terminal, then check where.exe opencode and npm prefix -g.
  • Drive a WSL install from Windows with opencode serve or opencode web, and set a server password.
  • Logs, credentials and caches live under %USERPROFILE%\.local\share\opencode and %USERPROFILE%\.cache\opencode.

Share this article

Post on XShare on LinkedIn

Related articles

Necessary cookies support sign-in, security, your language and this choice. Optional categories stay off until accepted.

First-party page views and acquisition measurement, plus Google Analytics 4 (Google Ireland, data may reach the US). Advertising personalization stays off.

With Analytics enabled, retain Google, Microsoft and Reddit ad click identifiers and share download, signup, activation and purchase conversions with the relevant ad provider. No personalized advertising.

Privacy · Cookie inventory