Install Claude Code on WSL : The complete guide for VS Code

As many of you know, my raw development level oscillates somewhere between absolute zero and “it miraculously started working”.
But now, the game has changed. Artificial intelligence, and more specifically CLI (Command Line Interface) coding agents like Claude Code, have given me superpowers. Suddenly, coding is no longer an insurmountable mountain, but a conversation. However, there’s a catch: to converse with the machine, your environment needs to be rock solid. And developing on Windows, historically, was a bit like trying to fit a square peg into a round hole.
Fortunately, WSL (Windows Subsystem for Linux) is here. The idea behind this guide? To save you from the cold sweats I experienced. I’m going to show you how to set up a clean Ubuntu environment on Windows, pack it with the necessary dependencies (Cargo, npm), install Claude Code, and connect it all seamlessly to Visual Studio Code.
Why bother with WSL2, you might ask? Quite simply because it allows us to completely isolate our AI tools. Claude Code will run in its own Linux sandbox, with native I/O performance, all completely independent of our Windows system. We keep full control.
Ready to transform your Windows machine into an AI-boosted development station? Follow the guide, I’ve cleared the minefield for you.
1. Enable and install WSL (Windows Subsystem for Linux)
Let’s not lie to ourselves: there was a time when installing a Linux environment on Windows was a real obstacle course. You had to dig into obscure menus, check “Windows Features”, and pray very hard. Today, Microsoft has caught up, and it all comes down to a single command line.
Installing WSL
Start by opening PowerShell as an administrator (right-click on the Start menu > Windows PowerShell (Admin) or Terminal (Administrator)).
Simply type this command and press Enter:
wsl --install
Let the magic happen. Once it’s finished, the golden rule of IT applies: restart your PC. This isn’t optional; Windows needs this reboot to activate the virtualization components at the system level.
WSL: Choosing your distribution
Upon reboot, WSL is there, but we’re going to make sure we install the right distribution. Reopen PowerShell (no need for admin rights this time).
To see what’s available in the “catalog”, type:
wsl --list --online

In our case, we’re going with the absolute standard, Ubuntu. That’s where the community is largest, and where you’ll find the most solutions if you ever run into an error message.
Launch the installation with:
wsl --install Ubuntu
A terminal window will open, asking you to create a UNIX username and a password.

Why does WSL2 change everything? For the more curious, you should know that this command enables WSL2 by default. This detail is crucial. Gone is the first version (WSL1) where Windows clumsily tried to translate Linux commands on the fly. Today, WSL2 uses a genuine, ultra-lightweight virtual machine (based on Hyper-V) with a real Linux kernel optimized by Microsoft. The result? 100% compatibility with development tools and blazing-fast file access (I/O) performance, which will be vital for Claude Code to read our code quickly.
2. Prepare the Ubuntu environment
Alright, the Linux distribution is installed, but a brand-new Linux system is like an empty apartment: it’s very clean, but you can’t do much in it.
Before bringing in our AI super-agent, we need to bring in the furniture, or rather the dependencies. Many modern CLI tools rely on very specific ecosystems.
Install Cargo (and our first AI tool)
For my own experiments, I often use the Rust ecosystem. So we’re going to install its package manager, cargo.
Type this into your Ubuntu terminal:
sudo apt install cargo
Why Cargo? Because it will allow us to install tools directly from their source code. For example, I use rtk, a highly practical AI framework. To install it, it’s as simple as this:
cargo install --git https://github.com/rtk-ai/rtk
Let it compile. It’s beautiful to watch (even if, I admit, I often watch these dozens of compilation lines scroll by like a deer in the headlights, just praying there won’t be any flashing red text at the end).
What is RTK for, you might ask? Well, it saves Claude Code tokens through automations, allowing us to chat longer with Anthropic’s AI to preserve our quotas.
Install Node.js and npm
Next, Claude Code and many other agents use web technologies. Therefore, we need npm (Node Package Manager).
Run the command:
sudo apt install npm
If a bearded and/or bald senior developer is reading this tutorial, he’s going to choke: “Ju, you never install npm via apt, it installs an old version and creates permission errors!”. And he would probably be right. The “real” best practice is to use NVM (Node Version Manager). However, let’s be pragmatic: for our specific goal of running Claude Code CLI today, the stable version provided by the Ubuntu repositories does the job perfectly. If, later on, you start racking up EACCES type errors when installing other global packages, you’ll know it’s time to clean it all up and switch to NVM!
3. Install and configure Claude Code
The official installation script
To install Claude Code, Anthropic made things simple. Well, “simple” in a Linux way. We’re going to use a tool called curl which will download a script from their servers and execute it directly on our machine.
Type this into your Ubuntu terminal:
curl -fsSL https://claude.ai/install.sh | bash
Normally, tossing an unknown script found on the net directly into your machine’s bash is the digital equivalent of picking up a USB drive on the sidewalk and plugging it straight into your PC. But hey, this is Anthropic, we’ll assume they don’t want to mine bitcoin on our backs.
The script will do its thing for a bit. And then, full of hope, eyes shining, you type claude in your terminal. And bam… claude: command not found.
Frustration. Cold sweats. Don’t panic, it’s a classic trap.
The infamous PATH trap
Why doesn’t it work on the first try?
Because Anthropic does things properly by respecting the principle of least privilege. Instead of brutally installing Claude Code at the root of your system (which would require super-administrator root rights and could break everything), the script places the executable in a neat little hidden folder of your own: ~/.local/bin.
The problem is that your Ubuntu system doesn’t look in this specific folder by default when you run a command. You have to explicitly show it the path. This is what we call the $PATH environment variable.
To fix this once and for all, we’re going to add this famous folder to our PATH. Copy and paste this line (be careful, copy it exactly with its quotes):
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc
This double command does two things: it writes the correct path at the end of your personal configuration file (.bashrc), and it asks the terminal to re-read this file immediately to apply the change (source).
Now, type claude or claude --version again. If a menu or a version number appears: you’ve won!

4. Final integration with VS Code
It’s all well and good to have the Claude CLI running quietly in a terminal on WSL, but the idea is still to have it read and write code comfortably. And for that, we need our trusty Visual Studio Code.
The WSL extension for VS Code
Open VS Code normally, on Windows. Go to the extensions tab and search for WSL (formerly Remote – WSL, published directly by Microsoft). Install it.
Once installed, look at the very bottom left of the VS Code window. You will see a small blue (or green) icon with >< chevrons. Click on it, and choose the “Connect to WSL” option.

A new VS Code window will open. In the bottom left corner, it now says “WSL: Ubuntu”. Bingo.
This is where the power of the architecture I mentioned earlier hits hard. When you open a project this way, VS Code installs a mini-server directly inside your Linux machine. The graphical interface (the editor) runs on Windows, but all the development logic, the integrated terminal, and file access run natively on Ubuntu.
The Claude plugin for VS Code
Having the CLI to run global commands is great, but let’s be honest: having Claude integrated directly into the editor’s interface is the ultimate comfort.
Still in this new VS Code window (connected to WSL), go back to the extensions tab and search for the official Claude extension (or Claude Dev/Cline depending on your preference).

⚠️ Warning: VS Code now manages two distinct “zones” of extensions. Those installed on your local Windows, and those installed inside your WSL machine. Make sure to click on the small blue button “Install in WSL: Ubuntu” if VS Code prompts you.
If you mistakenly install it on the Windows side, the plugin will spin its wheels and will be completely unable to read your Linux project files or understand the commands you send it.
Once the plugin is activated on the Ubuntu side, a new icon will appear in your sidebar. There you are, with the powerful CLI in the terminal below, and the responsive visual assistant on the side. A real control tower!
Conclusion
And there you have it, full circle. In a few command lines, we’ve gone from a walled-off Windows environment to an ultra-high-performance hybrid setup. You now have a clean Ubuntu subsystem, ready to compile Rust, run Node, and above all, host your new AI assistant.
For my part, with my “weekend dev” level, this setup has changed my life. I discuss, I guide, I supervise, and Claude manages the code. How about you, what will be your first project with this new stack?
0 comments