Skip to main content
Fixing Claude Code slowness in WSL
  1. Posts/
  2. AI/

Fixing Claude Code slowness in WSL

·2 mins
Table of Contents

If you’re like me, you probably love the Claude models. But when you tried Anthropic’s Claude Code CLI on Windows (specifically inside WSL, where most of us prefer to do our coding), the experience felt completely broken.

It was borderline unusable. We’re talking freezing for several seconds at startup, hanging before every / command, and even stuttering while typing. Since coding with AI usually works better in a Linux environment compared to PowerShell (where AI tooling compatibility can be a bit hit or miss), feeling blocked from using WSL smoothly with Claude Code was a huge turn-off.

Well, good news: there is a ridiculously easy fix!

It turns out the issue relates to how Windows paths are resolved. A massive thanks to Zach, who investigated this pesky, annoying issue in anthropics/claude-code issue #29672.

The Fix
#

All you need to do is add this single line to your WSL configuration file (~/.bashrc or ~/.zshrc):

export USERPROFILE=$(wslpath -u $(pwsh.exe -NoLogo -NoProfile -Command 'Write-Output ${env:USERPROFILE}'))

Once you save the file, simply run source ~/.bashrc (or restart your terminal), and you’re done! Claude Code should now be beautifully snappy in WSL. No more hanging or freezing.

I am incredibly looking forward to spending the weekend having fun with Claude Code to fix my small little utility (stay tuned for that!).

Now you can have a great Claude Code weekend too, if you fancy giving it another spin.

Happy prompting!


comments powered by Disqus