Home

Install Claude Code on Windows Using WSL

Claude Code is a powerful AI coding assistant, but Windows users face a challenge: many developer tools work better on Linux. The solution? WSL (Windows Subsystem for Linux) lets you run a full Linux environment inside Windows—like having two computers in one. This guide walks you through the complete setup so you can start coding with Claude in about 20 minutes.

Key Concepts

What You’ll Need

Step 1: Check if Virtualization is Enabled

Before installing WSL, you need to verify that virtualization is enabled on your computer. This is required for WSL to work.

If it says “Enabled”: Great! Continue to Step 2.

If it says “Disabled”: You need to enable virtualization in your computer’s BIOS settings:

Step 2: Open PowerShell as Administrator

A blue window with white text will open - this is PowerShell running as administrator.

Step 3: Install WSL

First, check if WSL and Ubuntu are already installed:

To install WSL and Ubuntu:

Why restart is needed: The restart allows Windows to enable the WSL and Virtual Machine Platform features that were just installed.

Note: If you get an error saying the command is not recognized, your Windows version might be too old. Make sure you have Windows 10 version 2004 or higher, or Windows 11. Run Windows Update to get the latest version.

Step 4: Set Up Ubuntu (First Time Only)

After your computer restarts, a terminal window with “Ubuntu” in the title should open automatically within 2-5 minutes.

If the Ubuntu window did NOT open automatically:

Now complete the first-time setup:

Important: Remember this username and password - you’ll need them later.

Step 5: Update Ubuntu

Step 6: Install Node.js

Claude Code requires Node.js version 18 or higher. Follow these steps:

Step 7: Install Claude Code

Step 8: Configure Your Anthropic API Connection

Option A. Use your Claude Pro or Max subscription

Option B. Use Anthropic API key

If you have an Anthropic API key instead of a Claude subscription:

Option C. Use Anthropic API via Azure Foundry

Before starting Claude Code, in the Ubuntu terminal window, paste this code to define environment variables:

# Enable Microsoft Foundry integration
export CLAUDE_CODE_USE_FOUNDRY=1
# Azure resource name
export ANTHROPIC_FOUNDRY_RESOURCE=xxxx-eastus2
# Set models to your resource's deployment names
export ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-4-5
export ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-4-5
export ANTHROPIC_FOUNDRY_API_KEY=your_api_key

Note: Replace xxxx-eastus2 with your Foundry Resource name (do not use the entire base URL). Replace your_api_key with your complete API key from your Azure portal.

Then start Claude Code:

claude

You should now be able to use Claude Code with Azure-deployed Claude models.

Step 9: Test Claude Code

You’re all set! To see if it works, ask a general question such as “Explain quantum computing.”

Step 10: Access Your Windows Projects

Note: Claude operates inside a project folder. It saves settings in that folder. It’s Claude’s workspace.

Next Steps

Troubleshooting

How to open Ubuntu terminal after closing it

“Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS”

This error means virtualization is not enabled:

“wsl –install” doesn’t work

Ubuntu window doesn’t open after restart

“sudo: apt: command not found”

Node.js installation fails

Claude Code commands not found

Need Help?


Created by Steven Ge on December 11, 2025.