Close Menu
  • AI Tools
    • Claude AI
    • ChatGPT
    • Cursor AI
    • GitHub Copilot
  • Programming
    • Python
    • JavaScript
  • About
  • Contact Us
Facebook X (Twitter) Instagram
Skill Trek
Facebook X (Twitter) Instagram Pinterest
  • AI Tools
    • Claude AI
    • ChatGPT
    • Cursor AI
    • GitHub Copilot
  • Programming
    • Python
    • JavaScript
  • About
  • Contact Us
Subscribe
Skill Trek
Home»Programming»JavaScript»How to Install OpenCode in WSL on Windows 11 (Step-by-Step Guide)
JavaScript

How to Install OpenCode in WSL on Windows 11 (Step-by-Step Guide)

Md Al MamunBy Md Al MamunNovember 22, 2026No Comments9 Mins Read
Share Facebook Bluesky Threads Pinterest Twitter LinkedIn Tumblr Email
Follow Us
Facebook X (Twitter) Pinterest LinkedIn
Share
Facebook Bluesky Pinterest Threads Email Copy Link

Want to use OpenCode on Windows without installing it directly on Windows? You can easily install and run OpenCode inside Windows Subsystem for Linux (WSL).

OpenCode is an open-source AI coding agent that helps you write code, build applications, debug projects, and interact with AI models directly from your terminal. It supports more than 200 AI providers and also offers access to several free AI models.

In this tutorial, I’ll show you how to install OpenCode inside WSL on Windows 11, step by step. We’ll first install WSL with Ubuntu, then install OpenCode, configure an AI model, and test whether everything is working correctly.

By the end of this guide, you’ll have a fully functional AI coding assistant running inside your Ubuntu terminal on Windows.

What You’ll Need Before Installing OpenCode

Before getting started, make sure you have:

  • A Windows 10 or Windows 11 computer.
  • An active internet connection.
  • Administrator access to your Windows account.
  • Windows PowerShell.
  • Basic knowledge of using terminal commands.

You don’t need to install a separate Linux operating system or create a dual-boot environment. WSL allows you to run Linux directly inside Windows.

Step 1: Enable Windows Subsystem for Linux (WSL)

First, you need to enable Windows Subsystem for Linux on your Windows computer.

  1. Click the Windows search bar.
  2. Search for PowerShell.
  3. Find Windows PowerShell in the search results.
  4. Right-click it and select Run as administrator.
  5. Click Yes when Windows asks for permission.

Once PowerShell opens, execute the following command:

wsl --install

Press Enter to begin the installation.

This command automatically installs the Windows Subsystem for Linux and downloads Ubuntu as the default Linux distribution.

The installation may take a few moments, depending on your internet connection and system configuration.

Note: If Windows asks you to restart your computer, save your work and restart it to complete the installation.

Step 2: Set Up Ubuntu on Windows

Once WSL installation is complete, Ubuntu should launch automatically.

Now, you need to create your default Linux user account.

First, Ubuntu will ask you to enter a username.

For example:

mtl

Enter your preferred username and press Enter.

Next, create a password for your Ubuntu account. Enter the password and press Enter. Then, type it again to confirm.

Important: Linux terminals don’t display characters while you’re typing a password. You won’t see dots or asterisks. This is normal.

Once your account is created successfully, you’ll see the Ubuntu terminal prompt.

Congratulations! You’ve successfully installed Ubuntu inside Windows using WSL.

Step 3: Visit the Official OpenCode Website

Now that Ubuntu is ready, it’s time to download and install OpenCode.

Open your web browser and visit the official OpenCode website:

Official Website: https://opencode.ai

OpenCode is an open-source AI coding agent designed to help developers work with AI directly from their terminal.

Some of its key features include:

  • Access to more than 200 AI providers.
  • Support for free and paid AI models.
  • Terminal-based coding assistance.
  • AI-powered code generation and debugging.
  • Integration with providers such as OpenAI, Anthropic, and Google.
  • The ability to work with your local development projects.

You can also use OpenCode from your phone through supported workflows.

On the homepage, click the Install button to view the available installation methods.

You’ll find several installation options, including:

  • curl
  • npm
  • Bun
  • Homebrew
  • Paru

Since we’re installing OpenCode inside Ubuntu on WSL, we’ll use the curl installation script or the npm command.

Step 4: Install OpenCode Inside WSL

Go to the installation section of the OpenCode website.

Choose the curl installation option and copy the provided command.

Alternatively, you can use the npm installation method if Node.js and npm are already installed in your Ubuntu environment.

Now, return to your Ubuntu terminal.

Paste the installation command and press Enter.

For the curl method, the command follows this format:

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

This command downloads and runs the official OpenCode installation script.

The installer will automatically download the required files, install OpenCode, and configure the executable.

Once the installation finishes, OpenCode should be available through your terminal.

Important: Always copy the latest installation command from the official OpenCode website because installation methods and commands can change over time.

Step 5: Reload Your Ubuntu Terminal

After installing OpenCode, you may need to reload your shell configuration so Ubuntu recognizes the newly installed command.

Run the following command:

source ~/.bashrc

Press Enter to refresh your Bash environment.

This allows your terminal to recognize updated environment variables and PATH settings.

Step 6: Verify the OpenCode Installation

Now, let’s check whether OpenCode has been installed successfully.

Inside your Ubuntu terminal, execute:

opencode --version

Press Enter.

If everything is working correctly, the terminal will display the installed OpenCode version.

For example:

2.3.2

The version number may differ depending on the latest release available when you install it.

If you see a version number, congratulations! OpenCode is successfully installed inside WSL.

Step 7: Launch OpenCode in Ubuntu

Now comes the exciting part!

To launch your AI coding assistant, simply execute:

opencode

Press Enter.

OpenCode will open its interactive terminal interface.

From here, you can interact with AI models, generate code, work on projects, and build applications directly from your Ubuntu environment.

Step 8: Select a Free AI Model

One of the best features of OpenCode is its support for multiple AI models.

You don’t necessarily need to purchase an API subscription to get started. You can explore the free models available through the supported OpenCode model catalog.

To view the available models, type:

/models

Press Enter.

OpenCode will display a list of available models.

Depending on current availability, you may find free models such as:

  • Big Pickle
  • DeepSeek V4.1 Flash Free
  • SY4 Flash Free
  • Iceman Free
  • LongCat
  • Beam
  • Mimo V2.6
  • Nemotron

Select the model you want to use.

For this tutorial, I’ll select Big Pickle as the default model.

Keep in mind that model availability, names, and free usage limits can change over time.

Step 9: Connect Additional AI Providers (Optional)

Besides the built-in free models, OpenCode allows you to connect external AI providers.

If you already have an API key from an AI provider, you can connect it to OpenCode.

Inside the OpenCode interface, press:

Ctrl + A

This opens the provider selection interface.

You’ll find several popular integrations, including:

  • OpenCode Go
  • OpenAI
  • GitHub Copilot
  • Anthropic
  • Google

For example, if you want to connect Anthropic, select Anthropic from the provider list.

OpenCode will ask you to provide your API key.

Paste your Anthropic API key and press Enter to authenticate.

Once authentication is successful, you can use supported Anthropic models inside OpenCode.

You can follow a similar process to connect other supported providers.

Tip: If you don’t have an API key, you can continue using the available free models instead.

Step 10: Test OpenCode to Make Sure It’s Working

Now let’s perform a quick test to confirm that your AI coding assistant is working correctly.

Make sure you’ve selected a model, such as Big Pickle.

Inside the OpenCode terminal interface, type:

hi

Press Enter.

Within a few seconds, the selected AI model should respond to your message.

If you receive a response, everything is working correctly!

You’ve successfully installed OpenCode inside Windows Subsystem for Linux and connected it to an AI model.

Common OpenCode Installation Problems and Solutions

Sometimes, you may encounter a few issues while installing or running OpenCode inside WSL. Here are some common problems and their solutions.

1. ‘wsl’ Is Not Recognized

If PowerShell displays an error saying that wsl is not recognized, make sure you’re running a supported version of Windows.

You can also update Windows and check whether the WSL feature is enabled.

2. OpenCode Command Not Found

If Ubuntu displays:

opencode: command not found

Try reloading your Bash configuration:

source ~/.bashrc

Then check the installation again:

opencode --version

If the problem continues, verify that the OpenCode installation directory is included in your PATH.

3. OpenCode Installation Fails

If the installation script fails, check your internet connection and make sure the required dependencies are available.

You can also revisit the official installation page to copy the latest installation command.

4. AI Model Doesn’t Respond

If an AI model doesn’t respond, check your internet connection and verify that the selected model is currently available.

For external providers, make sure you’ve configured a valid API key and have sufficient usage quota.

Frequently Asked Questions (FAQ)

1. Can I install OpenCode on Windows 11?

Yes. You can install OpenCode directly on Windows or run it inside Windows Subsystem for Linux (WSL). This tutorial demonstrates the WSL installation method using Ubuntu.

2. Is OpenCode free to use?

OpenCode is an open-source AI coding agent. However, using AI models may involve additional costs depending on the provider and model you choose. Some supported models offer free access with usage limitations.

3. Do I need Ubuntu to run OpenCode inside WSL?

Ubuntu is a popular Linux distribution for WSL and is the default distribution installed by the wsl --install command on supported Windows systems. Other supported Linux distributions may also work.

4. Can I use OpenAI or Claude models with OpenCode?

Yes. OpenCode supports multiple AI providers, including OpenAI and Anthropic. You can connect supported providers using their respective authentication methods or API keys.

5. Can I use OpenCode without an API key?

Yes. You can use available free models through supported integrations without configuring your own external provider API key. Availability and usage limits depend on the model and service.

6. How do I check the installed OpenCode version?

Open your Ubuntu terminal and run:

opencode --version

The terminal will display your installed version.

Final Thoughts

That’s it! You’ve successfully learned how to install OpenCode inside WSL on Windows 11.

We started by enabling Windows Subsystem for Linux, installed Ubuntu, configured a Linux user account, and installed OpenCode using the official installation script.

We also explored how to select free AI models, connect external providers such as OpenAI and Anthropic, and test the AI assistant directly from the terminal.

Now you can start using OpenCode to generate code, debug applications, build projects, and improve your development workflow.

If you found this tutorial helpful, don’t forget to share it with other developers who want to explore AI-powered coding tools.

Watch the complete video tutorial: [Insert Your YouTube Video Link Here]

Happy coding!

Share. Facebook Pinterest Telegram Bluesky Threads Email Copy Link
Previous ArticleHow to Get an ElevenLabs API Key (Step-by-Step Guide)
Next Article How to Add a Custom Provider in OpenCode
Md Al Mamun
  • Website
  • Facebook
  • X (Twitter)
  • Instagram
  • LinkedIn

a full-stack developer and educator with a community of over 144,000 learners across YouTube, Udemy, and Facebook. With years of hands-on experience in building modern web applications, I specialize in making complex topics easy to understand through clear, structured explanations and real-world examples.

Add A Comment
Leave A Reply Cancel Reply

Recent Posts

  • How to Use Hermes AI Agent with Ollama (Step-by-Step Guide)
  • How to Call an API in Python (Step-by-Step Guide for Beginners)
  • OpenCode Skills Tutorial: From Setup to Efficient AI Agents
  • How to Add a Custom Provider in OpenCode
  • How to Install OpenCode in WSL on Windows 11 (Step-by-Step Guide)

Recent Comments

No comments to show.

Archives

  • November 2026
  • September 2026
  • August 2026

Categories

  • AI Tools
  • Claude AI
  • Google Antigravity
  • JavaScript
  • Programming
  • Python
Quick Access
  • Home
  • About
  • Contact Us
  • Privacy Policy
  • Disclaimer
Facebook X (Twitter) Instagram Pinterest
  • Home
  • About
  • Contact Us
  • Privacy Policy
  • Disclaimer
© 2026 SkillTrek. All Rights Preserved by Md Al Mamun.

Type above and press Enter to search. Press Esc to cancel.