Install command
Not provided
Complete Claude Code WSL2 installation tutorial in 30 minutes. Configure Node.js, resolve PATH conflicts, and optimize Windows development performance.
Open the source and read safety notes before installing.
Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.
Decision playbook
Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.
0
78
—
No baseline selected
No major trust-signal divergence detected in the current selection.
Confirm ownership and provenance before trusting install instructions.
Source link availableRequired
Open the canonical repository and verify ownership.
Source provenance statusRequired
Marked as source-backed.
Metadata reviewed
Registry metadata indicates a reviewed listing.
Validate risk disclosures before installation or API wiring.
Safety notes presentRequired
Review the listed safety guidance before running commands.
Privacy notes presentRequired
Review data handling notes before connecting accounts or secrets.
Trust level risk gateRequired
Trust level does not block evaluation.
Check package metadata and artifact integrity signals.
Install payload available
Install or copy payload is available for review.
Package verification flag
No package verification flag provided.
Checksum metadata
No checksum provided for downloaded artifact.
Use compare context to validate trade-offs before adoption.
Compare tray has multiple entries
Add at least one more entry to compare trust differences.
Baseline comparison available
No baseline peer selected yet.
Diverging trust signals identified
No major trust-signal divergence found.
Setup at a glance
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
Current risk score 16/100. Use staged verification before broader rollout.
Validate source and review signals before any execution.
Confirm source provenanceRequired
Source URL/provenance metadata is present.
Confirm metadata review state
Listing has review metadata.
Verify install payload
Install/config payload exists and can be inspected.
Confirm safety, privacy, and package integrity signals.
Review safety notesRequired
Safety notes are present.
Review privacy notesRequired
Privacy notes are present.
Verify package integrity metadata
No package verification/checksum metadata.
Adopt in controlled steps based on the selected plan.
Run in isolated sandbox firstRequired
Use a constrained sandbox and observe behavior across multiple tasks.
Roll out graduallyRequired
Roll out to a small cohort before wider usage.
Set monitoring and fallback
Define rollback path and monitor errors after adoption.
Evidence readiness
Required evidence gates are covered (5/6 signals complete).
Source repository/provenance is listed.
Required in this preset
Review metadata is present.
Required in this preset
Safety notes are present.
Required in this preset
Privacy notes are present.
Optional in this preset
Package integrity metadata is missing.
Optional in this preset
Install payload is available.
Required in this preset
Required evidence gates are covered for this preset.
Decision timeline
5/6 steps complete with no blocking gaps for this preset.
triage
Source/provenance metadata is available.
triage
Review metadata is available.
verify
Safety notes are available.
verify
Privacy notes are available.
verify
Package integrity metadata is missing.
rollout
Install payload is available.
No required blockers for this timeline preset.
Safety & privacy surface
1 safety and 1 privacy notes across 2 risk areas. Review closely: credentials & tokens.
## 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)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.
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.
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.
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
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
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:
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
PATHimporting viaappendWindowsPath = 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.
| 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 |
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 status | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed |
| Package trust | Package not verified | Package not verified | Package not verified | Package not verified |
| Source provenance | Source-backed | Source-backed | Source-backed | Source-backed |
| Submitter | — | — | — | — |
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ |
| Brand | — | — | — | — |
| Category | guides | guides | guides | guides |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | JSONbored | JSONbored | JSONbored | JSONbored |
| Added | 2025-10-27 | 2025-10-27 | 2025-10-27 | 2025-10-27 |
| Platforms | Claude Code | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — | — |
| 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. | ✓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 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. | ✓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 | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Source-backed guides for putting this to work.
Get productive with Claude Code if you're coming from ChatGPT.
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.