Why is this such a painfully annoying process, I've been at it for hours FFS Answer from Deleted User on reddit.com
🌐
Reddit
reddit.com › r/claudeai › how to use claude code in vs code in windows via wsl
r/ClaudeAI on Reddit: How to use Claude Code in Vs Code in Windows via WSL
May 25, 2025 -

What a title. Anyways, figured I'd make a quick little guide on how to do this.

Prerequisites:

  • VS Code

  • Git repository (not an actual requirement, just how I did it with my limited bash knowledge)

Steps

1. Open up PowerShell and install WSL with:

cmd
wsl --install

2. Set Ubuntu as default (important!):

cmd
wsl --set-default Ubuntu

3. Open a WSL terminal

Tip: check the upper left dropdown menu in Windows Terminal that will show various terminals available

4. Install Claude Code in the WSL terminal (if you have issues, please refer to Anthropic's guide):

bash
npx u/anthropic-ai/claude-code

5. Make a directory for your projects:

bash
mkdir coolProjects && cd coolProjects

6. Clone your project (optional):

bash
git clone https://github.com/yourrepo.git

7. Open VS Code

8. Install the official WSL extension

9. Press F1

10. Type "WSL"

IMPORTANT

11. Select "WSL: Connect to WSL using Distro"

Choose Ubuntu.

From here you can now open a folder within VS Code.

How do you know it worked? Check the bottom left corner of VS Code - it should say "WSL: Ubuntu" and your Claude Code extension should be enabled!

Troubleshooting

If you get Alpine Linux errors or "libstdc++ required" messages: This usually happens if you have Docker Desktop installed and it became your default WSL distribution instead of Ubuntu. Run wsl --list --verbose to check, and if docker-desktop-data has an asterisk (*), run wsl --set-default Ubuntu to fix it. That's why step 2 is so important!

Hope this is helpful!

🌐
Qiita
qiita.com › claude
WSL2(Ubuntu)上のClaude CodeとVSCodeを連携する #ClaudeCode - Qiita
June 6, 2025 - Nodeが入ったら以下コマンドでClaude Codeをインストールします。 ... WSL上からcode <Root Directory>のコマンドでVSCodeを起動します。 (今いるディレクトリで良い場合は、code .)
🌐
Latenode
community.latenode.com › other questions › npm
Can Claude Code be set up with Docker containers for VSCode on Windows WSL environment? - NPM - Latenode Official Community
August 17, 2025 - My goal is to: Set up Claude Code through Docker containers in my WSL environment Include Node.js and npm in the containerized setup Access it through VSCode running on Windows using the Claude Code extension I’ve heard about VSCode Dev Containers which might work for this use case...
🌐
GitHub
github.com › anthropics › claude-code › issues › 1276
[BUG] Claude Code integration with VS Code not working on Windows · Issue #1276 · anthropics/claude-code
May 23, 2025 - The impression I've gotten is that Claude will install it's extension, since the installation instructions just says: "Run claude - the extension will auto-install". I've search the VS Code marketplace and there isn't extension there from Anthropic to install manually. I asked Claude and it hallucinated a marketplace link that was a 404. In Ubuntu WSL terminal: sudo npm install -g @anthropic-ai/claude-code
Published   May 23, 2025
🌐
ClaudeLog
claudelog.com › home › install
ClaudeLog - Claude Code Docs, Guides, Tutorials & Best Practices
Access Claude Code: Click the Spark icon in VS Code's sidebar · Features: Plan mode, auto-accept edits, file picker, conversation history · For WSL users: Install the WSL extension: ms-vscode-remote.remote-wsl · Connect VS Code to WSL: code ...
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Claude Code Assistant - Visual Studio Marketplace
Extension for Visual Studio Code - Claude Code Assistant - Now supports Windows, WSL, and macOS!
🌐
Medium
jewelhuq.medium.com › install-wsl-claude-code-on-windows-complete-guide-2025-873bd4a29478
Install WSL & Claude Code on Windows — Complete Guide 2025 | by Md Mazaharul Huq | Medium
July 23, 2025 - Step-by-step tutorial to enable WSL on Windows, isolate Node.js with NVM, install Anthropic’s Claude Code CLI, and start coding with AI in your terminal.
Find elsewhere
🌐
4sysops
4sysops.com › home › blog › articles › install anthropic claude code as vs code “extension”
Install Anthropic Claude Code as VS Code “extension”
May 26, 2025 - If you choose to run Claude Code on Windows, install it on WSL 2 as WSL 1 isn't supported. Following that, you can link VS Code running on Windows to WSL using Microsoft’s WSL extension.
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Chat for Claude Code - Visual Studio Marketplace
Extension for Visual Studio Code - Beautiful Claude Code Chat Interface for VS Code
🌐
JHB Software
jhb.software › articles › setup claude code inside cursor with wsl on windows
Setup Claude Code Inside Cursor with WSL on Windows - JHB Software Articles
June 22, 2025 - Learn how to install and integrate Claude Code with Cursor using WSL on Windows. This step-by-step guide covers everything from setup to full IDE integration for optimal AI-assisted development performance.
🌐
GitHub
github.com › cline › cline › issues › 5175
Cline VS Code Extension fails to use Claude Code API in WSL due to CLAUDE_CODE_MAX_OUTPUT_TOKENS error · Issue #5175 · cline/cline
July 26, 2025 - What happened? ## Cline VS Code Extension fails to use Claude Code API in WSL due to CLAUDE_CODE_MAX_OUTPUT_TOKENS error Description When using the Cline VS Code extension with Claude Code as the API provider in WSL, Cline encounters an ...
Published   Jul 26, 2025
🌐
Claude
code.claude.com › docs › en › vs-code
Use Claude Code in VS Code - Claude Code Docs
Install and configure the Claude Code extension for VS Code. Get AI coding assistance with inline diffs, @-mentions, plan review, and keyboard shortcuts.
🌐
Medium
medium.com › @joe.njenga › 47-claude-code-wsl-tricks-every-windows-user-should-know-5d42aaee2d93
47 Claude Code WSL Tricks Every Windows User Should Know | by Joe Njenga | Medium
July 13, 2025 - Getting Claude Code running optimally requires more than just a simple installation. Unlike macOS or native Linux environments, Windows users must navigate the Windows Subsystem for Linux (WSL) to unlock Claude Code’s full potential.
🌐
Eesel AI
eesel.ai › blog › vs-code-claude-code
A complete guide to using VS Code Claude Code in 2025 - eesel AI
Learn how to install, configure, and master the VS Code Claude Code integration. This guide covers setup, features, workflows, and common troubleshooting tips.
🌐
iTechs Online
itecsonline.com › post › how-to-install-claude-code-on-windows
How To Install Claude Code on Windows: Complete Guide 2025 | Blog // ITECS
July 30, 2025 - This comprehensive guide walks Windows users through the complete process of installing Claude Code using WSL. It covers system requirements, pre-installation setup, detailed step-by-step instructions, troubleshooting common issues, and best practices for maximizing productivity.
🌐
Arsturn
arsturn.com › blog › claude-code-windows-mac-setup-guide
Guide to Claude Code on Windows (WSL) & Mac (Parallels)
Here's how to build the ultimate Claude-powered dev setup on Windows. ... If you want to keep things simple, you don't even need WSL. Install VS Code: If you haven't already, grab it from the official site.
🌐
Reddit
reddit.com › user/sabertoaster › how to use claude code in vs code in windows via wsl
r/u_SaberToaster on Reddit: How to use Claude Code in Vs Code in Windows via WSL
June 27, 2025 - How do you know it worked? Check the bottom left corner of VS Code - it should say "WSL: Ubuntu" and your Claude Code extension should be enabled!
🌐
Reddit
reddit.com › r/claudeai › complete wsl + claude code + cursor setup guide for windows
r/ClaudeAI on Reddit: Complete WSL + Claude Code + Cursor Setup Guide for Windows
June 22, 2025 -

Complete and Corrected Guide: WSL + Claude Code + Cursor Setup for Windows

Overview

This guide walks you through setting up a professional development environment with WSL2, Cursor, and command-line tools like Claude Code – based on proven best practices.

Phase 1: Windows Preparation

1. Windows Updates

  • Settings → Update & Security → Windows Update

  • Install all available updates and restart PC if needed

2. Install Important Dependencies

Open PowerShell as Administrator and ensure important developer tools are installed:

  • Visual C++ Redistributables (all common versions)

  • DirectX (current version)

These are often necessary for compiling tools (e.g., via npm or pyenv).

3. Enable WSL Features

Open PowerShell as Administrator:

powershell
# Enable WSL and Virtual Machine Platform
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Restart Windows: shutdown /r /t 0

Phase 2: WSL2 Installation

4. Install WSL2 (after restart)

PowerShell as Administrator:

powershell
# Install WSL2 with default distribution (Ubuntu)
wsl --install

If this doesn't work, specify explicitly: wsl --install -d Ubuntu-22.04

Restart Windows again.

5. Verify WSL2 Installation

After restart, open PowerShell:

powershell
wsl -l -v

Expected output should show VERSION as 2.

If 1 is displayed, upgrade to WSL2:

powershell
# Set WSL2 as default
wsl --set-default-version 2
# Convert existing distribution to version 2
wsl --set-version Ubuntu-22.04 2

6. Complete Ubuntu Setup

  • An Ubuntu terminal window opens automatically

  • Create a username (lowercase, no spaces)

  • Create a password

  • Wait for installation to complete

7. Update Ubuntu

In Ubuntu terminal:

bash
sudo apt update && sudo apt upgrade -y

Phase 3: Install Developer Tools in WSL

8. Install Essential Tools

In Ubuntu terminal:

bash
# Git, Curl and Build Tools
sudo apt install git curl build-essential -y

# Python dependencies
sudo apt install python3-pip python3-venv -y

9. Configure Git

bashgit config --global user.name "Your Name"
git config --global user.email "[email protected]"
git config --global init.defaultBranch main

10. Install Python with pyenv (in WSL)

Install pyenv dependencies:

bashsudo apt install make libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev \
libffi-dev liblzma-dev -y

Install pyenv:

bash
curl https://pyenv.run | bash

Add pyenv to shell and reload:

bashecho 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
source ~/.bashrc

Install a Python version and set as default:

bashpyenv install 3.11.8
pyenv global 3.11.8

11. Install Node.js with nvm (in WSL)

[NOTE] We use the officially recommended command to always get the latest nvm installation script.

bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash

Reload shell so nvm is available:

bash
source ~/.bashrc

Install latest LTS version of Node.js and use it:

bashnvm install --lts
nvm use --lts

Phase 4: Cursor Installation and Configuration

12. Install Cursor on Windows

Download Cursor from the official website and install it.

13. Install Important Cursor Extensions

In Cursor via Ctrl + Shift + X:

  • Remote - WSL (ms-vscode-remote.remote-wsl)

  • Remote Development (ms-vscode-remote.vscode-remote-extensionpack)

  • Python (ms-python.python)

  • Prettier (esbenp.prettier-vscode)

14. Configure Cursor WSL Settings

Ctrl + , → Settings, search and set:

json{
    "terminal.integrated.defaultProfile.windows": "WSL",
    "terminal.integrated.cwd": "~/dev/projects"
}

[NOTE] The setting remote.WSL.fileWatcher.polling is usually no longer needed and can cause high CPU usage. Only add it if you notice that file changes aren't being detected.

Phase 5: Set Up Project Structure

15. Create Project Structure in WSL

bash
# Main development folder
mkdir -p ~/dev/projects

[NOTE] You can create additional subfolders as needed.

16. Set Up Default Terminal Path and Aliases

bash
# Edit .bashrc
nano ~/.bashrc

Add the following at the end of the file:

bash
# Change to project folder when opening a new terminal
cd ~/dev/projects

# Useful aliases
alias dev='cd ~/dev/projects'
alias home='cd ~'

Save: Ctrl + O, Enter, Ctrl + X. Reload: source ~/.bashrc

Phase 6: Claude Code Installation

17. Install Claude Code

bash
# Switch to any folder, e.g., the project folder
cd ~/dev/projects

# Install Claude Code globally (DO NOT use sudo)
npm install -g @anthropic-ai/claude-code

18. Claude Code Setup and Authentication

After installation, set up Claude Code with these specific steps:

A. Navigate to your project directory

bash
cd ~/dev/projects

B. Start Claude Code

bash
claude

C. Complete Authentication

When you first run claude, you'll see authentication options:

  1. Anthropic Console (Pay-as-you-go):

    • Choose this option if you want to pay per API usage

    • Requires active billing at console.anthropic.com

    • Claude will open a browser window for OAuth authentication

    • If you're in WSL without GUI, the URL will be printed in terminal

    • Open the URL on any computer and sign in with your Anthropic credentials

  2. Claude App (Pro/Max Plan):

    • Choose this if you have a Claude Pro ($20/month) or Max ($100-200/month) subscription

    • Log in with your Claude.ai account credentials

    • This provides a unified subscription for both Claude Code and web interface

D. IDE Integration (Automatic)

For VS Code/Cursor integration:

  1. Automatic Extension Installation:

    • When you run claude from within VS Code/Cursor's integrated terminal, the IDE extension is installed automatically

    • No manual installation steps required

  2. Access Claude Code in VS Code/Cursor:

    • Open VS Code/Cursor in your project folder

    • Run claude in the integrated terminal (Ctrl + Shift + `)

    • Look for the Claude icon that appears in the activity bar, or

    • Press Ctrl+ESC (Windows/Linux) or Cmd+ESC (Mac)

    • This opens Claude Code in a WebView panel within your IDE

E. Test the Installation

bash
# Check if Claude Code is working
claude --version

# Start an interactive session
claude

# In the Claude Code interface, try:
/help

F. Initial Project Setup (Recommended)

bash
# Generate a project guide (helps Claude understand your codebase)
# In Claude Code session, ask:
"Please create a CLAUDE.md file that documents this project structure and setup"

# Commit the generated file
git add CLAUDE.md
git commit -m "Add Claude Code project documentation"

Phase 7: Test Cursor-WSL Integration

19. Connect Cursor to WSL

  • Open Cursor

  • Click the green >< icon in the bottom left and select "Connect to WSL"

20. Open Workspace in WSL

In WSL terminal:

bash
# Navigate to your project folder
dev 
# Use alias

# Open Cursor in current directory
code .

Verification: Cursor opens and shows "WSL: Ubuntu-22.04" in the bottom left. The integrated terminal (Ctrl + Shift + ) shows a Linux prompt ($`).

Phase 8: Test the Entire Environment

21. Check Versions

In Cursor WSL terminal:

bashgit --version
python --version  
# Should show the pyenv version
node --version    
# Should show the nvm version
npm --version

22. Check Paths

bashwhich python  
# Should point to pyenv shim path
which node    
# Should point to nvm path
pwd           
# Should be /home/username/dev/projects

23. Test with Python Virtual Environment

bashmkdir test-python && cd test-python
python -m venv venv
source venv/bin/activate
pip list
deactivate
cd .. && rm -rf test-python

Troubleshooting (Updated)

command not found: claude-code

  • Ensure you used the correct package name with npm install -g <package-name>

  • Check if nvm is loaded correctly (nvm current should show a version)

EACCES errors with npm install -g

[CORRECTION] This error should not occur with this guide. If it does, nvm is not active correctly. Ensure the nvm lines are in your .bashrc and you've run source ~/.bashrc. Never run npm with sudo when using nvm.

Issues with Cursor-WSL Integration

  • Restart WSL: wsl --shutdown in PowerShell, then reopen Ubuntu

  • Reset remote caches in Cursor: Ctrl + Shift + P → "Remote-WSL: Kill WSL Server"

Completion Checklist

✅ WSL2 enabled and Ubuntu installed & updated
✅ Git configured
✅ Python installed with pyenv
✅ Node.js installed with nvm (correct method, no manual npm prefix)
✅ Cursor installed with WSL extensions
✅ Project structure created
✅ "Claude Code" (or other tool) correctly installed
✅ Cursor-WSL integration working
✅ All tests successful

🎉 Installation Complete!

[IMPORTANT] Never use sudo with npm when nvm is installed, as this can cause permission issues and security risks.

[CORRECTION] This section replaces the erroneous "Configure NPM without sudo" phase. nvm already handles this correctly.

🌐
Medium
medium.com › ai-insights-cobet › comprehensive-guide-to-setting-up-claude-code-on-windows-using-wsl-d3a3f3b5a128
Comprehensive Guide to Setting Up Claude Code on Windows Using WSL | by azhar | azhar labs | Medium
March 27, 2025 - Setting up Claude Code, Anthropic’s AI-driven coding assistant, on a Windows system involves leveraging the Windows Subsystem for Linux (WSL). This approach ensures compatibility and a seamless development experience.