Skip to content

Field note

Claude Code on WSL: Fix Slow Repositories

When Claude Code crawls on WSL, the repository is almost always sitting on the Windows drive under /mnt/c rather than in the Linux filesystem.

When Claude Code crawls on WSL, the repository is almost always sitting on the Windows drive under /mnt/c rather than in the Linux filesystem.

Symptoms

  • Claude Code takes a long time to answer "where is X defined" questions, or reports fewer search matches than you expect. claude doctor still shows Search as OK.
  • git status, npm install and test runs are noticeably slower inside WSL than in PowerShell on the same machine.
  • CPU or memory use climbs during a long session, and the terminal occasionally freezes.
  • Occasionally claude will not start at all with cannot execute binary file: Exec format error.

If any of these appear only on the Windows laptop and not on a Mac or a Linux VM with the same repository, the cause is the WSL setup rather than the model or the prompts.

Likely causes, most common first

  1. The project lives on the Windows filesystem. Microsoft's own guidance is blunt: store files in the WSL filesystem when you work from a Linux command line, and avoid working across the two. A path that starts /mnt/c/ is a mounted Windows drive, and every file read pays a cross-filesystem penalty. Anthropic's troubleshooting page confirms that this penalty can cause slow or incomplete search results in Claude Code.
  2. Windows Node or npm is being picked up inside WSL. WSL imports the Windows PATH by default, so which node can point at /mnt/c/.... Tools then run through the interop layer, which is slow and sometimes breaks.
  3. The distribution is still WSL1. WSL1 has a known native-binary regression with Claude Code, and it is generally slower for Linux workloads.
  4. Large build directories are in scope. node_modules, dist, .next and similar folders inflate every search unless they are ignored.
  5. A plugin, MCP server or hook is doing extra work. This shows up as high CPU in a session that was fine last week.

Step-by-step fix

  1. Check where you are. Run pwd in the repository. If it starts with /mnt/, that is the problem to fix first.
  2. Check the WSL version from PowerShell:
wsl -l -v

If the distribution shows version 1, convert it:

wsl --set-version <DistroName> 2
  1. Move the repository into the Linux filesystem. Clone it again rather than copying a working tree with Windows line endings and permissions:
mkdir -p ~/projects && cd ~/projects
git clone <your-repo-url>

You can still open the folder from Windows through \\wsl$ in File Explorer, and explorer.exe . from the WSL prompt opens the current directory. VS Code's WSL remote mode works with this layout.

  1. Check the toolchain is Linux-native:
which node && which npm && which claude

Paths under /usr/, ~/.nvm or ~/.local/bin are correct. Paths under /mnt/c/ are Windows binaries. Install Node through your distribution's package manager or nvm, and if you installed Claude Code with npm and saw a platform mismatch, run npm config set os linux before npm install -g @anthropic-ai/claude-code --force. The native installer avoids this entirely. Do not set appendWindowsPath = false as a shortcut; it breaks calling Windows tools from WSL.

  1. Run claude doctor and read the Search line. If the bundled ripgrep is not running, install the system package with sudo apt install ripgrep and set USE_BUILTIN_RIPGREP to 0 in the env block of ~/.claude/settings.json. The Search line should then show the system ripgrep path instead of OK (bundled).
  2. Add build output to .gitignore so it drops out of searches. Ask for narrower searches while you are at it: "find the JWT check in the auth package" is cheaper than "find the login code".
  3. If the session is still heavy, run /compact, or restart and claude --continue. Start once with claude --safe-mode; if the load drops, a plugin, MCP server or hook is responsible.

What IT should check

  • The standard developer image. If new laptops default to cloning into C:\Users\... and opening WSL there, the slowness is baked in. Document ~/projects as the home for repositories.
  • Antivirus and endpoint scanning of the WSL virtual disk. Real-time scanning of every file read is a common hidden cost. Follow your endpoint product's guidance on exclusions rather than switching protection off.
  • Whether developers are on the native Claude Code installer or a mix of npm installs. One install path makes support far easier. Our command not found fix covers the PATH side.
  • Login over WSL2. The browser opens on the Windows side, so users paste a code into the terminal. If the browser does not open, set BROWSER to the Windows browser path, for example /mnt/c/Program Files/Google/Chrome/Application/chrome.exe.

Running Claude Code natively on Windows is a legitimate option and Anthropic lists it as a fix. For a small team, though, a well-placed WSL2 repository is usually simpler than maintaining two toolchains. If you want a second opinion on the developer setup before it spreads, our Claude Code services page explains what we look at.

When to escalate to Anthropic

Escalate when the repository is in the Linux filesystem, the toolchain is Linux-native, claude doctor is clean and performance is still poor. Run /doctor and /heapdump if memory is the complaint, attach only the -diagnostics.json file to a GitHub issue, and never share the .heapsnapshot, which contains your full conversation and credentials. Note the Claude Code version from claude --version, the WSL version and the distribution.

Source basis

Keep reading

Related notes

26 Aug 2026 · 5 min

Claude Code Hooks: Put Checks Before the Merge

A review gate built from Claude Code hooks runs the same cheap checks on every agent action, so the human reviewer only sees diffs that have already passed the boring tests.