Skip to main content
guidesSource-backedReview first Safety Privacy

Claude Code WSL Setup 2026

Complete Claude Code WSL2 installation tutorial in 30 minutes. Configure Node.js, resolve PATH conflicts, and optimize Windows development performance.

by JSONbored·added 2025-10-27·
HarnessClaude Code
Review first review before installing

Open the source and read safety notes before installing.

Citation facts

Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.

Source URLs
https://code.claude.com/docs/en/setup, https://github.com/JSONbored/awesome-claude/blob/main/content/guides/wsl-setup-guide.mdx
Safety notes
Setup runs install commands and shell configuration changes (npm global install, editing ~/.bashrc, wsl --set-version); review each command and run it in a trusted environment.
Privacy notes
Authentication uses a browser login flow that stores credentials locally; keep account tokens and login codes out of shared shell history or committed files, and review the BROWSER path you set.
Author
JSONbored
Claim status
unclaimed
Last verified
2025-10-27

Decision playbook

Review trust signals before you adopt

Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.

Compare context
Selected

0

Current score

78

Baseline

Delta

No baseline selected

No major trust-signal divergence detected in the current selection.

Source and provenance checks

Complete

Confirm ownership and provenance before trusting install instructions.

  • Source link availableRequired

    Open the canonical repository and verify ownership.

    Done
  • Source provenance statusRequired

    Marked as source-backed.

    Done
  • Metadata reviewed

    Registry metadata indicates a reviewed listing.

    Done

Safety and privacy checks

Complete

Validate risk disclosures before installation or API wiring.

  • Safety notes presentRequired

    Review the listed safety guidance before running commands.

    Done
  • Privacy notes presentRequired

    Review data handling notes before connecting accounts or secrets.

    Done
  • Trust level risk gateRequired

    Trust level does not block evaluation.

    Done

Package and install checks

Needs review

Check package metadata and artifact integrity signals.

  • Install payload available

    Install or copy payload is available for review.

    Done
  • Package verification flag

    No package verification flag provided.

    Pending
  • Checksum metadata

    No checksum provided for downloaded artifact.

    Pending

Compare-driven decision checks

Needs review

Use compare context to validate trade-offs before adoption.

  • Compare tray has multiple entries

    Add at least one more entry to compare trust differences.

    Pending
  • Baseline comparison available

    No baseline peer selected yet.

    Pending
  • Diverging trust signals identified

    No major trust-signal divergence found.

    Pending

Setup at a glance

Copy & paste

Copy-ready — paste the snippet to get started.

Install command

Not provided

Config snippet

Not provided

Copy snippet

Provided

Prerequisites

None

Platforms

1 listed

Difficulty

60/100

Adoption plan

Balanced adoption plan

Current risk score 16/100. Use staged verification before broader rollout.

Risk 16

Pre-adoption checks

Validate source and review signals before any execution.

  • Confirm source provenanceRequired

    Source URL/provenance metadata is present.

    Done
  • Confirm metadata review state

    Listing has review metadata.

    Done
  • Verify install payload

    Install/config payload exists and can be inspected.

    Done

Security checks

Confirm safety, privacy, and package integrity signals.

  • Review safety notesRequired

    Safety notes are present.

    Done
  • Review privacy notesRequired

    Privacy notes are present.

    Done
  • Verify package integrity metadata

    No package verification/checksum metadata.

    Pending

Rollout

Adopt in controlled steps based on the selected plan.

  • Run in isolated sandbox firstRequired

    Use a constrained sandbox and observe behavior across multiple tasks.

    Pending
  • Roll out graduallyRequired

    Roll out to a small cohort before wider usage.

    Pending
  • Set monitoring and fallback

    Define rollback path and monitor errors after adoption.

    Pending

Evidence readiness

Evidence readiness matrix · balanced

Required evidence gates are covered (5/6 signals complete).

Risk 15

Source provenance

Present

Source repository/provenance is listed.

Required in this preset

Metadata review

Present

Review metadata is present.

Required in this preset

Safety notes

Present

Safety notes are present.

Required in this preset

Privacy notes

Present

Privacy notes are present.

Optional in this preset

Package integrity

Missing

Package integrity metadata is missing.

Optional in this preset

Install payload

Present

Install payload is available.

Required in this preset

Required evidence gates are covered for this preset.

Decision timeline

Decision timeline · balanced

5/6 steps complete with no blocking gaps for this preset.

Risk 14

triage

Confirm source provenanceRequired

Source/provenance metadata is available.

Done

triage

Check metadata review statusRequired

Review metadata is available.

Done

verify

Review safety notesRequired

Safety notes are available.

Done

verify

Review privacy notes

Privacy notes are available.

Done

verify

Validate package integrity metadata

Package integrity metadata is missing.

Pending

rollout

Verify install payload and commandsRequired

Install payload is available.

Done

No required blockers for this timeline preset.

Safety & privacy surface

Safety & privacy surface

1 safety and 1 privacy notes across 2 risk areas. Review closely: credentials & tokens.

2 areas
  • SafetyExecution & processesSetup runs install commands and shell configuration changes (npm global install, editing ~/.bashrc, wsl --set-version); review each command and run it in a trusted environment.
  • PrivacyCredentials & tokensAuthentication uses a browser login flow that stores credentials locally; keep account tokens and login codes out of shared shell history or committed files, and review the BROWSER path you set.

Safety notes

  • Setup runs install commands and shell configuration changes (npm global install, editing ~/.bashrc, wsl --set-version); review each command and run it in a trusted environment.

Privacy notes

  • Authentication uses a browser login flow that stores credentials locally; keep account tokens and login codes out of shared shell history or committed files, and review the BROWSER path you set.

Schema details

Install type
copy
Reading time
3 min
Difficulty score
60
Troubleshooting
Yes
Breaking changes
No
Skill and platform metadata
Retrieval sources
https://code.claude.com/docs/en/setuphttps://code.claude.com/docs/en/troubleshoot-installhttps://code.claude.com/docs/en/troubleshooting
Full copyable content
## Overview

Windows developers have two supported ways to run Claude Code: natively on Windows, or inside the Windows Subsystem for Linux (WSL). This guide focuses on the WSL path, which is the right choice when your projects live in a Linux toolchain or when you want sandboxed command execution, a feature WSL 2 supports and native Windows does not.

The most important decision happens before you type a single command: **which installer you use**. Anthropic recommends the native installer (a standalone binary that auto-updates in the background) over an npm global install. Inside WSL the npm route is also where most setup pain comes from, because WSL imports the Windows `PATH` by default and can silently pick up the Windows copies of `node` and `npm` instead of the Linux ones. The native installer sidesteps that entire class of problems.

> **Requirements**
>
> Claude Code supports Windows 10 1809+ or Windows Server 2019+, with 4 GB+ RAM and an x64 or ARM64 processor. WSL 2 must be enabled for sandboxing; WSL 1 works but does not support sandboxing and has a known native-binary regression (covered in Troubleshooting). You also need a Pro, Max, Team, Enterprise, or Console account to authenticate.

## Choose: native installer vs npm

Both methods install the *same* native binary. The difference is how it gets onto your system, how it updates, and how much can go wrong in WSL.

| Aspect | Native installer (recommended) | npm global install |
| --- | --- | --- |
| Install command | Native installer (see [setup docs](https://code.claude.com/docs/en/setup)) | `npm install -g @anthropic-ai/claude-code` |
| Prerequisites | None | Node.js 18 or later |
| Auto-updates | Yes, in the background | No, re-run with `@latest` |
| WSL PATH/OS-detection pitfalls | Avoided entirely | Common (WSL may use Windows `node`/`npm`) |
| Install location | `~/.local/bin/claude` | npm global prefix |
| `sudo` needed | No | No, and never use `sudo npm install -g` |

Unless you have a specific reason to manage Claude Code through npm, use the native installer inside your WSL distribution.

## Step 1: Set up WSL 2

If you do not already have WSL, install it and a Linux distribution from an elevated PowerShell, then make sure you are on WSL 2 for sandboxing support. Run these in **Windows PowerShell**, not inside WSL:

```powershell
# Install WSL with the default Ubuntu distribution
wsl --install

# List installed distributions and their WSL version
wsl --list --verbose

# Upgrade an existing distribution to WSL 2 (replace <DistroName>)
wsl --set-version <DistroName> 2
```

After installation, open your WSL distribution from the Start menu (or run `wsl` from PowerShell) so the remaining steps run *inside* the Linux shell.

## Step 2: Install Claude Code in WSL

Inside your WSL terminal, install Claude Code. The npm install is shown below; Anthropic also publishes a native installer documented in the [setup guide](https://code.claude.com/docs/en/setup). Install and launch `claude` from within WSL, not from PowerShell or CMD.

```bash
# Install Claude Code with npm (Node.js 18+)
npm install -g @anthropic-ai/claude-code

# Confirm it installed and is on your PATH
claude --version

# Run a full health check of your install and configuration
claude doctor
```

If `claude --version` reports `command not found`, the install directory (`~/.local/bin`) is not on your `PATH`. Add it and reload your shell:

```bash
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
claude --version
```

## Step 3: Start and authenticate

Open a terminal in the project you want to work in and start Claude Code:

```bash
cd ~/your-project
claude
```

On first run, Claude Code launches a browser login flow. In WSL the browser often opens on the Windows side and its redirect cannot reach Claude Code's local callback server, so after signing in the browser shows a login code instead of redirecting automatically. Paste that code into the terminal to finish logging in.

If the browser does not open at all from WSL, point Claude Code at your Windows browser:

```bash
export BROWSER="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"
claude
```

## File system performance

This is the single biggest performance lever on WSL. Disk reads across the Windows/Linux file-system boundary are slow, and Claude Code's search can return **fewer results than expected** when your project lives on the Windows file system. Keep your projects on the Linux file system (under `/home/`), not under `/mnt/c/`.

Two practical mitigations if you must work on the Windows file system:

- Submit more specific searches that limit the files scanned (for example, "Search for JWT validation logic in the auth-service package" rather than searching the whole tree).
- Move the project onto the Linux file system, or consider running Claude Code natively on Windows for better file-system performance.

## Troubleshooting

The table below maps the WSL-specific symptoms documented by Anthropic to their fixes.

| Symptom | Cause | Fix |
| --- | --- | --- |
| `cannot execute binary file: Exec format error` when running `claude` | You are on WSL 1, which can't load the native binary's program headers | Convert to WSL 2: `wsl --set-version <DistroName> 2`. If you must stay on WSL 1, invoke `claude` through the dynamic linker (below). |
| npm reports a platform/OS mismatch during `npm install -g` | WSL picked up the Windows `npm` | Run `npm config set os linux`, then `npm install -g @anthropic-ai/claude-code --force`. Do not use `sudo`. |
| `exec: node: not found` when running `claude` (npm install) | WSL is using the Windows Node.js | Check with `which node` / `which npm`; `/mnt/c/...` paths are Windows binaries. Install Node via your Linux package manager or `nvm`. |
| Browser login never completes in WSL 2 | Redirect can't reach the local callback server | Paste the displayed login code into the terminal, or set `BROWSER` to your Windows browser path. |
| Slow or incomplete search results | Cross-file-system disk penalty | Move the project to `/home/`, or scope searches more narrowly. |

**WSL 1 dynamic-linker workaround.** If you cannot move to WSL 2, add this function to `~/.bashrc` (adjust the path if your home directory differs), then `source ~/.bashrc`:

```bash
claude() {
  /lib64/ld-linux-x86-64.so.2 "$(readlink -f "$HOME/.local/bin/claude")" "$@"
}
```

> **Don't break Windows interop**
>
> Avoid disabling Windows `PATH` importing via `appendWindowsPath = false`; it stops you from calling Windows executables from WSL. Likewise, don't uninstall Node.js from Windows if you still use it for Windows development. The fixes above prefer the Linux toolchain without removing the Windows one.

For anything not covered here, run `/doctor` inside a session (or `claude doctor` from your shell if Claude Code won't start) for an automated check of your installation, settings, and MCP configuration.

## Quick reference

| Command | What it does |
| --- | --- |
| `wsl --install` | Install WSL and the default Ubuntu distribution |
| `wsl --set-version <DistroName> 2` | Upgrade a distribution to WSL 2 |
| `claude --version` | Verify the install |
| `claude doctor` / `/doctor` | Diagnose install, settings, and MCP health |
| `claude` | Start Claude Code in the current directory |

## Related resources

- [Claude Code setup and system requirements](https://code.claude.com/docs/en/setup)
- [Troubleshoot installation and login](https://code.claude.com/docs/en/troubleshoot-install)
- [Troubleshooting (performance, search, and WSL)](https://code.claude.com/docs/en/troubleshooting)

About this resource

Overview

Windows developers have two supported ways to run Claude Code: natively on Windows, or inside the Windows Subsystem for Linux (WSL). This guide focuses on the WSL path, which is the right choice when your projects live in a Linux toolchain or when you want sandboxed command execution, a feature WSL 2 supports and native Windows does not.

The most important decision happens before you type a single command: which installer you use. Anthropic recommends the native installer (a standalone binary that auto-updates in the background) over an npm global install. Inside WSL the npm route is also where most setup pain comes from, because WSL imports the Windows PATH by default and can silently pick up the Windows copies of node and npm instead of the Linux ones. The native installer sidesteps that entire class of problems.

Requirements

Claude Code supports Windows 10 1809+ or Windows Server 2019+, with 4 GB+ RAM and an x64 or ARM64 processor. WSL 2 must be enabled for sandboxing; WSL 1 works but does not support sandboxing and has a known native-binary regression (covered in Troubleshooting). You also need a Pro, Max, Team, Enterprise, or Console account to authenticate.

Choose: native installer vs npm

Both methods install the same native binary. The difference is how it gets onto your system, how it updates, and how much can go wrong in WSL.

Aspect Native installer (recommended) npm global install
Install command Native installer (see setup docs) npm install -g @anthropic-ai/claude-code
Prerequisites None Node.js 18 or later
Auto-updates Yes, in the background No, re-run with @latest
WSL PATH/OS-detection pitfalls Avoided entirely Common (WSL may use Windows node/npm)
Install location ~/.local/bin/claude npm global prefix
sudo needed No No, and never use sudo npm install -g

Unless you have a specific reason to manage Claude Code through npm, use the native installer inside your WSL distribution.

Step 1: Set up WSL 2

If you do not already have WSL, install it and a Linux distribution from an elevated PowerShell, then make sure you are on WSL 2 for sandboxing support. Run these in Windows PowerShell, not inside WSL:

# Install WSL with the default Ubuntu distribution
wsl --install

# List installed distributions and their WSL version
wsl --list --verbose

# Upgrade an existing distribution to WSL 2 (replace <DistroName>)
wsl --set-version <DistroName> 2

After installation, open your WSL distribution from the Start menu (or run wsl from PowerShell) so the remaining steps run inside the Linux shell.

Step 2: Install Claude Code in WSL

Inside your WSL terminal, install Claude Code. The npm install is shown below; Anthropic also publishes a native installer documented in the setup guide. Install and launch claude from within WSL, not from PowerShell or CMD.

# Install Claude Code with npm (Node.js 18+)
npm install -g @anthropic-ai/claude-code

# Confirm it installed and is on your PATH
claude --version

# Run a full health check of your install and configuration
claude doctor

If claude --version reports command not found, the install directory (~/.local/bin) is not on your PATH. Add it and reload your shell:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
claude --version

Step 3: Start and authenticate

Open a terminal in the project you want to work in and start Claude Code:

cd ~/your-project
claude

On first run, Claude Code launches a browser login flow. In WSL the browser often opens on the Windows side and its redirect cannot reach Claude Code's local callback server, so after signing in the browser shows a login code instead of redirecting automatically. Paste that code into the terminal to finish logging in.

If the browser does not open at all from WSL, point Claude Code at your Windows browser:

export BROWSER="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"
claude

File system performance

This is the single biggest performance lever on WSL. Disk reads across the Windows/Linux file-system boundary are slow, and Claude Code's search can return fewer results than expected when your project lives on the Windows file system. Keep your projects on the Linux file system (under /home/), not under /mnt/c/.

Two practical mitigations if you must work on the Windows file system:

  • Submit more specific searches that limit the files scanned (for example, "Search for JWT validation logic in the auth-service package" rather than searching the whole tree).
  • Move the project onto the Linux file system, or consider running Claude Code natively on Windows for better file-system performance.

Troubleshooting

The table below maps the WSL-specific symptoms documented by Anthropic to their fixes.

Symptom Cause Fix
cannot execute binary file: Exec format error when running claude You are on WSL 1, which can't load the native binary's program headers Convert to WSL 2: wsl --set-version <DistroName> 2. If you must stay on WSL 1, invoke claude through the dynamic linker (below).
npm reports a platform/OS mismatch during npm install -g WSL picked up the Windows npm Run npm config set os linux, then npm install -g @anthropic-ai/claude-code --force. Do not use sudo.
exec: node: not found when running claude (npm install) WSL is using the Windows Node.js Check with which node / which npm; /mnt/c/... paths are Windows binaries. Install Node via your Linux package manager or nvm.
Browser login never completes in WSL 2 Redirect can't reach the local callback server Paste the displayed login code into the terminal, or set BROWSER to your Windows browser path.
Slow or incomplete search results Cross-file-system disk penalty Move the project to /home/, or scope searches more narrowly.

WSL 1 dynamic-linker workaround. If you cannot move to WSL 2, add this function to ~/.bashrc (adjust the path if your home directory differs), then source ~/.bashrc:

claude() {
  /lib64/ld-linux-x86-64.so.2 "$(readlink -f "$HOME/.local/bin/claude")" "$@"
}

Don't break Windows interop

Avoid disabling Windows PATH importing via appendWindowsPath = false; it stops you from calling Windows executables from WSL. Likewise, don't uninstall Node.js from Windows if you still use it for Windows development. The fixes above prefer the Linux toolchain without removing the Windows one.

For anything not covered here, run /doctor inside a session (or claude doctor from your shell if Claude Code won't start) for an automated check of your installation, settings, and MCP configuration.

Quick reference

Command What it does
wsl --install Install WSL and the default Ubuntu distribution
wsl --set-version <DistroName> 2 Upgrade a distribution to WSL 2
claude --version Verify the install
claude doctor / /doctor Diagnose install, settings, and MCP health
claude Start Claude Code in the current directory

Related resources

Source citations

Add this badge to your README

Show that Claude Code WSL Setup 2026 is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/guides/wsl-setup-guide.svg)](https://heyclau.de/entry/guides/wsl-setup-guide)

How it compares

Claude Code WSL Setup 2026 side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.

Field

Complete Claude Code WSL2 installation tutorial in 30 minutes. Configure Node.js, resolve PATH conflicts, and optimize Windows development performance.

Open dossier

Install Claude Code correctly in 15-25 minutes. Fix npm permission errors, configure PATH, and resolve 'command not found' issues with proven solutions.

Open dossier

Diagnose and fix Claude Code 429 errors, session and weekly usage limits, and high token consumption using built-in commands and documented settings.

Open dossier

Fix Claude Code high CPU and memory usage, hangs, slow responses, and auto-compact thrashing using /context, /compact, /clear, /doctor, and documented context-management techniques.

Open dossier
Next steps
Trust
Review statusReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewed
Package trustPackage not verifiedPackage not verifiedPackage not verifiedPackage not verified
Source provenanceSource-backedSource-backedSource-backedSource-backed
Submitter
Install riskReview firstReview firstReview firstReview first
Notes Safety Privacy Safety Privacy Safety Privacy Safety Privacy
Brand
Categoryguidesguidesguidesguides
Sourcesource-backedsource-backedsource-backedsource-backed
AuthorJSONboredJSONboredJSONboredJSONbored
Added2025-10-272025-10-272025-10-272025-10-27
Platforms
Claude Code
Claude Code
Claude Code
Claude Code
Source repo
Safety notesSetup runs install commands and shell configuration changes (npm global install, editing ~/.bashrc, wsl --set-version); review each command and run it in a trusted environment.Some fixes use privileged operations (sudo chown/mkdir to repair ownership, swap-file creation) and edit shell profiles or proxy variables; run them only on systems you control and never use sudo npm install -g.Changing retry, timeout, and concurrency environment variables or spend limits alters how Claude Code calls the API; review these before applying them in shared or CI environments./heapdump writes a JavaScript heap snapshot (which can contain session content) to your Desktop or home directory; do not attach heap snapshots to public issues, and share only redacted diagnostics through a private support channel when requested.
Privacy notesAuthentication uses a browser login flow that stores credentials locally; keep account tokens and login codes out of shared shell history or committed files, and review the BROWSER path you set.Proxy and TLS fixes may reference internal hosts, credentials, and CA certificate paths; keep proxy URLs with embedded credentials out of committed config and shared logs./usage and cost figures are computed locally from this machine's session history and reflect only this device; the commands send no data beyond normal model requests./usage cost figures and /context breakdowns are computed locally from this machine's session history and do not include usage from other devices or claude.ai.
Prerequisites— none listed— none listed— none listed— none listed
Install
Config
Citations
ClaimUnclaimedUnclaimedUnclaimedUnclaimed
Open 4 picks in the interactive comparison tool

Related guides

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.