Claude Code on Windows: native or WSL, install and errors
Install Claude Code on Windows with PowerShell, CMD or WinGet, or in WSL 2: Git Bash vs PowerShell, where settings and sign-in live, and the Windows errors.
Claude Code runs natively on 64-bit Windows 10 (version 1809 or later) and Windows 11, on x64 or ARM64, and installing it needs no administrator rights. In PowerShell, run irm https://claude.ai/install.ps1 | iex; in CMD, curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd; or use winget install Anthropic.ClaudeCode. Open a new terminal and run claude. Git for Windows is optional: without it, Claude runs its shell commands in PowerShell; with it, Claude also gets Bash through Git Bash.
Use WSL 2 instead when the project and its tools are Linux ones, or when you want Claude’s command sandbox, which native Windows does not have. Install from inside the WSL terminal with the Linux command, curl -fsSL https://claude.ai/install.sh | bash, and keep the project in the Linux filesystem rather than under /mnt/c. As of November 23, 2026 the current release is 2.1.330.
Native Windows or WSL 2
Anthropic supports both, and the Windows section of its setup page puts the choice down to where your projects are and which features you need. What changes between the two:
| Native Windows | WSL 2 | |
|---|---|---|
Install from | PowerShell, CMD or WinGet | The WSL terminal, with the Linux installer |
Needs | Nothing; Git for Windows is optional | WSL 2 and a distribution such as Ubuntu |
Claude runs commands in | PowerShell, and Git Bash if installed | Bash |
Command sandbox | Not supported | Supported |
Settings and sign-in | %USERPROFILE%\.claude | ~/.claude in the Linux home |
Paste an image | Alt+V | Ctrl+V or Alt+V |
Suits | Windows projects and tools | Linux toolchains, sandboxed commands |
WSL 1 is the docs’ fallback for machines where WSL 2 is unavailable. It has no sandbox, and the native binary hits a known loader regression there (the Exec format error under the errors below).
The two are separate installations. A copy inside WSL is a Linux program that keeps its settings and sign-in in ~/.claude inside the distribution, and for a VS Code window connected to WSL, Anthropic’s docs say to edit ~/.claude/settings.json on that system, not on your local computer.
Run Claude on the side of the boundary your files are on. A WSL session working on /mnt/c is slow, and Anthropic warns its searches can return fewer matches than on a native filesystem while claude doctor still reports Search as OK; Microsoft’s own advice is “We recommend against working across operating systems with your files”. The reverse holds too: Windows reaching into a distribution’s files “goes through a network filesystem, which is slow and breaks file watching,” in the words of the desktop app’s WSL page.
Install on native Windows
Pick the command for the terminal you are in. The prompt reads PS C:\Users\YourName> in PowerShell and C:\Users\YourName> without the PS in CMD.
# PowerShell
irm https://claude.ai/install.ps1 | iex
# CMD
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
# WinGet, from either
winget install Anthropic.ClaudeCodeCopiedThe PowerShell installer refuses to run as a 32-bit process, takes the native ARM64 build when PowerShell runs as an ARM64 process and the x64 build otherwise, downloads it to %USERPROFILE%\.claude\downloads, checks its SHA-256 against the release manifest, and then runs claude install. It shows no progress while it downloads. The program lands at %USERPROFILE%\.local\bin\claude.exe, with its versions under %USERPROFILE%\.local\share\claude, and the executable is signed by “Anthropic, PBC” (Get-AuthenticodeSignature .\claude.exe in that folder shows it). For the stable channel, which runs about a week behind, pass it as an argument:
& ([scriptblock]::Create((irm https://claude.ai/install.ps1))) stableCopiedThen open a new terminal, because the one you installed from keeps its old PATH, and check:
claude --version # prints e.g. 2.1.330 (Claude Code)
claude doctor # install health, settings errors, warningsCopiedIf the folder is not on your PATH
The installer does not edit PATH. When .local\bin is missing from it, the output carries this under Setup notes:, and claude is not recognized until you add the folder:
Native installation exists but C:\Users\you\.local\bin is not in your PATH.CopiedAnthropic’s fix, for PowerShell, checks the file is there and adds the folder to your user PATH:
Test-Path "$env:USERPROFILE\.local\bin\claude.exe" # True: it is installed
$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
[Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')CopiedRestart the terminal. A terminal inside VS Code or another editor takes its PATH from the editor, so quit and reopen the editor too. Installing only the VS Code extension does not give you a claude command: it bundles a private copy for its own panel and leaves PATH alone.
WinGet and npm
A WinGet install does not update itself. On November 23, 2026 WinGet’s package was at 2.1.330, level with npm’s latest tag. Run winget upgrade Anthropic.ClaudeCode, or set CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE=1 so Claude Code runs the upgrade for you; Windows locks the executable while Claude Code runs, so that upgrade can fail and hand you the command instead. The installer’s copy updates itself in the background. Channels, held versions and update errors are in how to update Claude Code.
npm install -g @anthropic-ai/claude-code also works and needs Node.js 22 or later, but in PowerShell it is the route that can meet running scripts is disabled on this system (fix below). The native installer avoids it.
Signing in
Run claude and follow the browser prompts; it needs a Pro, Max, Ultra, Team, Enterprise or Console account (or a cloud provider such as Amazon Bedrock), since the free claude.ai plan does not include Claude Code. If the browser shows a code instead of returning you to the terminal, paste it at the prompt. If pasting does nothing, try right-click or Shift+Insert in Windows Terminal, or run claude auth login, which reads the pasted code from standard input.
The shell Claude uses: PowerShell, Git Bash, or both
On native Windows, which shell Claude’s commands run in depends on whether Git for Windows is installed:
- Without Git for Windows: Claude Code turns on its PowerShell tool and does not register the Bash tool at all. The Monitor tool, which watches logs and jobs in the background, needs Git Bash and is not available. Hooks and status line commands run in PowerShell too.
- With Git for Windows: the Bash tool runs in Git Bash, and for claude.ai and Console sign-ins the PowerShell tool is on as well. When both are on, Claude treats PowerShell as its main shell and keeps Bash for POSIX scripts. On Amazon Bedrock, Google Cloud’s Agent Platform or Microsoft Foundry, PowerShell needs
CLAUDE_CODE_USE_POWERSHELL_TOOL=1. Set it to0to keep Claude in Bash.
One catch in the second case: the PowerShell default arrives through a feature flag, and Claude Code skips fetching flags when DISABLE_TELEMETRY, DO_NOT_TRACK, CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC or CLAUDE_CODE_DISABLE_FEATURE_FLAGS is set. Commands then go through Git Bash unless you set CLAUDE_CODE_USE_POWERSHELL_TOOL=1 yourself. The default can also be missing in your first session after installing or upgrading, until Claude Code has fetched and saved its flags.
What to know about the PowerShell tool
- It uses
pwsh.exe(PowerShell 7 or later) when it finds one and falls back topowershell.exe, Windows PowerShell 5.1. - It starts PowerShell with
-ExecutionPolicy Bypassat process scope, so.ps1scripts run on a default Windows install without changing the machine’s policy. Group Policy still applies, andCLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY=1makes it honour your effective policy instead. - Your PowerShell profile is not loaded, a documented limitation of the tool’s preview, so aliases and functions defined there are not available to Claude.
- A result of
Error: Exit code 1is often not a failure.rgandgrepreturn 1 for no matches,git diffandfc.exefor files that differ, andwhere.exefor nothing found;robocopyreports results with 0 to 7 and fails only from 8 up.
When Git Bash is installed but not found
Without CLAUDE_CODE_GIT_BASH_PATH, Claude Code looks for bash.exe in C:\Program Files\Git and C:\Program Files (x86)\Git, then the bin\bash.exe of the Git installation whose git is on your PATH. It skips a git in the folder you launched from, or below it inside node_modules or a virtual-environment folder, so a project cannot plant one. For Git anywhere else, find it with where.exe git and set the path in %USERPROFILE%\.claude\settings.json, with each backslash doubled:
{
"env": {
"CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe"
}
}CopiedThe file must be named bash.exe, sh.exe, bash or sh. Point it at Git for Windows’ git-bash.exe launcher, or at a path that does not exist, and Claude Code ignores the variable, auto-detects as if it were unset, and logs a warning you see only with --debug.
Permission rules and hooks see two shells
A Bash rule does not restrict the PowerShell tool, so on Windows with Git Bash installed, any Bash deny rule, even a narrow one such as Bash(git push *), turns PowerShell off for the session. A deny rule on the whole Bash tool then leaves Claude with no shell; a -p run with text output warns about that on stderr:
Denying Bash also turns off the PowerShell tool, so Claude has neither. To use PowerShell, set CLAUDE_CODE_USE_POWERSHELL_TOOL=1.CopiedTo keep PowerShell, set that variable or add a matching PowerShell deny rule such as PowerShell(git push *). PowerShell rules match case-insensitively and through aliases, so PowerShell(Get-ChildItem *) also covers gci, ls and dir. A hook that inspects shell commands should match Bash|PowerShell: one matching only Bash never fires for PowerShell commands. The hooks guide covers the rest.
If shell commands feel slow, check that you are on the current release. Per the changelog, 2.1.326 made a session’s first Bash command about a second faster, 2.1.327 made PowerShell commands up to about half a second faster each, and 2.1.330 fixed Bash staying slow for the rest of a session after Git Bash took 10 to 60 seconds to start, on machines with no custom start-up files.
Install in WSL 2
If WSL is not set up yet, wsl --install in PowerShell run as administrator, then a restart, sets it up with Ubuntu on WSL 2; the steps and the BIOS trap are in how to install WSL2. Then open the distribution and use the Linux installer. Claude is installed and started inside the WSL terminal, not from PowerShell or CMD, and needs no Git for Windows:
curl -fsSL https://claude.ai/install.sh | bash
claude --versionCopiedFrom there it is a Linux install: the PATH note after installing, the apt repository and the update channels are in Claude Code on Linux. The WSL-specific parts:
- Signing in. If no browser opens, or the browser signs you in and then shows a connection error for a
localhostaddress, use the login URL the terminal prints above its paste prompt (presscto copy it), sign in, and paste the code the browser shows atPaste code here. To have Claude open your Windows browser next time, setBROWSERto its path before startingclaude, as inexport BROWSER="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe". - Where the project lives. Under
/home, not/mnt/c, for the speed and search reasons above. - npm picking up Windows’ Node. If you installed with npm inside WSL and
claudefails withexec: node: not found, WSL is likely using the Windows Node.js:which nodeshows a path starting/mnt/c/. Install Node inside the distribution, or use the native installer, which needs no Node. For an npm platform mismatch, runnpm config set os linux, thennpm install -g @anthropic-ai/claude-code@latest --force, withoutsudo. - The sandbox. On WSL 2 it needs
bubblewrapandsocat, as on Linux; turning it on and what it blocks are in the Claude Code sandbox guide. WSL starts a Windows program such ascmd.exe,powershell.exeor anything under/mnt/c/through a Unix socket, so once the sandbox’s optional seccomp filter is installed, a sandboxed command cannot launch one unlesssandbox.network.allowAllUnixSocketsis on, which opens every Unix socket. - The desktop app. Claude’s Windows app can run a Code session inside a WSL 2 distribution, with the Claude Code process, its tools and git all running there; it needs git installed in the distribution, and plugins are not available in those sessions.
Where settings, sign-in and history live
On Windows, every ~/.claude path in Anthropic’s docs means %USERPROFILE%\.claude. Inside WSL, ~ is the Linux home.
| What | Native Windows | WSL |
|---|---|---|
The program (installer’s copy) | %USERPROFILE%\.local\bin\claude.exe | ~/.local/bin/claude |
Your settings | %USERPROFILE%\.claude\settings.json | ~/.claude/settings.json |
Account, MCP servers, project state | %USERPROFILE%\.claude.json | ~/.claude.json |
Sign-in | %USERPROFILE%\.claude\.credentials.json | ~/.claude/.credentials.json |
Session history, auto memory | %USERPROFILE%\.claude\projects | ~/.claude/projects |
Your organization’s policy | C:\Program Files\ClaudeCode\managed-settings.json | /etc/claude-code/managed-settings.json |
The sign-in is a file on Windows, as on Linux, not an encrypted store like the macOS Keychain. Per the authentication docs, it inherits the access controls of your profile folder, which limit it to your account by default. It holds a live login, so keep it out of repositories and shared backups. CLAUDE_CONFIG_DIR moves your settings, history, plugins and the sign-in to another folder. The managed settings file is read from C:\Program Files\ClaudeCode\; Claude Code does not read the legacy C:\ProgramData\ClaudeCode\managed-settings.json.
What else differs from macOS and Linux
- No sandbox. On native Windows, commands run unsandboxed. With
sandbox.failIfUnavailableset, Claude Code exits at startup on Windows rather than run without it. - Saved approvals stay in the start folder. “Yes, and don’t ask again” writes its rule to
.claude\settings.local.jsonin the folder you started Claude Code in, beside the sharedsettings.jsonit reads there; on macOS and Linux it goes to the repository root even when you start in a subfolder. - Paths in permission rules are written the Unix way. Claude Code normalizes
C:\Users\aliceto/c/Users/alicebefore matching, so a Read or Edit rule for.envfiles anywhere on the C: drive uses//c/**/.env, and//**/.envcovers every drive (see permissions). - Network shares. A UNC path such as
\\server\sharecannot be a working directory, because looking it up can send your Windows credentials to that host, and commands that name one prompt. Map it to a drive and pass that at launch:net use Z: \\server\share, thenclaude --add-dir Z:\. Mapped drive letters and\\wsl$paths do not count as network paths. - Backslashes in config. Inside
settings.json, write each backslash twice. In a status line command, which runs in Git Bash when it is installed, write paths with forward slashes: Git Bash treats unquoted backslashes as escapes, and the command fails without a visible error (status line guide). - Keys. Paste an image with
Alt+V(Ctrl+Von macOS and Linux,Cmd+Vin iTerm2).Ctrl+Backspacedeletes the previous word.Alt+Mstands in forShift+Tabto cycle permission modes when the runtime does not enable VT input mode. If plain Backspace deletes a whole word, your terminal sends^Hfor it; setCLAUDE_CODE_BS_AS_CTRL_BACKSPACE=0. - New lines. Shift+Enter inserts a line break in Windows Terminal 1.25 or later and sends the prompt in older versions;
Ctrl+Jworks everywhere. The full terminal list is in Claude Code new line.
Install and start-up errors on Windows
All but the last two are on Anthropic’s install troubleshooting page with their causes; those two come from its error reference and its changelog.
- The command for the wrong shell.
'irm' is not recognizedmeans you are in CMD;The token '&&' is not a valid statement separatormeans you ran the CMD line in PowerShell.A parameter cannot be found that matches parameter name 'fsSL'or'bash' is not recognizedmeans you ran the macOS and Linux installer; in Windows PowerShell,curlis an alias forInvoke-WebRequest, which rejects-fsSL. If the script’s text scrolls past and nothing installs, you ran onlyirm https://claude.ai/install.ps1without| iex. 'claude' is not recognized as an internal or external command(CMD), orThe term 'claude' is not recognized(PowerShell). The PATH fix above, then a new terminal. If an old version answers,where.exe claudelists every copy; keep one, preferably the native one.Claude Code does not support 32-bit Windows. Usually the Start menu’s “Windows PowerShell (x86)” entry, a 32-bit process even on a 64-bit PC. If[Environment]::Is64BitOperatingSystemprintsTrue, open plain “Windows PowerShell” and run the installer again.Falsemeans 32-bit Windows, which Claude Code does not support.running scripts is disabled on this systemnamingnpm.ps1orclaude.ps1. PowerShell’s execution policy is blocking npm’s launcher scripts. RunSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser, callnpm.cmdandclaude.cmdinstead, or switch to the native installer, which this policy does not affect.Failed to download binary: The process cannot access the file. Usually another installer window is still running, or antivirus is scanning the half-downloaded file. Close the other window, wait, then clear the folder and retry:
Remove-Item -Recurse -Force "$env:USERPROFILE\.claude\downloads"
irm https://claude.ai/install.ps1 | iexCopied- HTML instead of the script. In PowerShell this shows up as parse errors quoting HTML or CSS, or as
The term 'System.Xml.XmlDocument' is not recognized; in CMD as< was unexpected at this time.followed by a web page. The download address returned a page instead of the installer. If the text mentions “App unavailable in region”, Claude Code is not offered in your country; otherwise retry later, check for a proxy, or use WinGet. Could not create SSL/TLS secure channelin Windows PowerShell 5.1. Run[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12, then the installer in the same window. Behind a TLS-inspecting corporate proxy, its certificate has to be in the Windows certificate store for the installer, andNODE_EXTRA_CA_CERTShas to point at it for Claude Code itself.CRYPT_E_NO_REVOCATION_CHECKorCRYPT_E_REVOCATION_OFFLINEfrom the CMD installer. Your network blocks certificate revocation lookups. Add--ssl-revoke-best-effortto thatcurl, or use the PowerShell installer or WinGet, which do not hit this.Claude Code on Windows requires either Git for Windows (for bash) or PowerShell. Neither shell was found. PowerShell normally lives inC:\Windows\System32\WindowsPowerShell\v1.0\: put that folder back on PATH, install PowerShell 7, or install Git for Windows with “Add to PATH” selected. IfCLAUDE_CODE_GIT_BASH_PATHnames the right file and Git Bash is still not used, security software such as AppLocker or an EDR agent may be in the way; Anthropic’s advice is to have IT allowclaude.exeand what it starts, includingcmd.exeandbash.exe.- Typing
claudeopens the desktop app. An older Claude Desktop may have registered aClaude.exeunderWindowsAppsthat wins on PATH. Update the desktop app. 'claude' is not recognizedstraight after an update. An update renamesclaude.exeaside to a backup and moves the new one in; if the move fails and the backup cannot be renamed back, only the backup,claude.exe.old.plus a timestamp, is left. Put the newest back (versions before 2.1.281 could delete it, in which case rerun the installer):
Get-ChildItem "$env:USERPROFILE\.local\bin\claude.exe.old.*" | Sort-Object Name | Select-Object -Last 1 | Rename-Item -NewName claude.exeCopiedcannot execute binary file: Exec format errorin WSL. The distribution is on WSL 1, where a change in the native binary broke loading (issue #38788). Convert it from PowerShell withwsl --set-version <DistroName> 2;wsl -l -vshows which version each distribution runs. To stay on WSL 1, the troubleshooting page gives a~/.bashrcfunction that starts the binary through the dynamic linker.Windows reported an error (EBADF)when resuming a session. The error reference puts it down to security, encryption or endpoint-management software intercepting reads of the transcript. Exclude%USERPROFILE%\.claude\projectsfrom it, or add Claude Code to its allowed applications, and resume again.- Plugins failing to install on long paths. Fixed in 2.1.323 for cloned files whose path reached 260 characters, Windows’ classic path limit; update first.
Uninstall
For the installer’s copy, in PowerShell, or with WinGet if that is how you installed it:
Remove-Item -Path "$env:USERPROFILE\.local\bin\claude.exe" -Force
Remove-Item -Path "$env:USERPROFILE\.local\share\claude" -Recurse -Force
winget uninstall Anthropic.ClaudeCodeCopiedSettings, the sign-in and session history stay behind in %USERPROFILE%\.claude and %USERPROFILE%\.claude.json. Remove those as well only if you want all of it gone, and uninstall the VS Code extension, the JetBrains plugin and the desktop app first, since each writes to the same folder and recreates it. A copy inside WSL is removed from the WSL terminal, as on any Linux machine.