When you use WSL2, Codex runs inside the Linux environment instead of using the native Windows sandbox. Choose WSL2 when you need Linux-native tooling, your repositories and developer workflow already live in WSL2, or neither native Windows sandbox mode works for your environment.
WSL1 was supported through Codex 0.114. Starting in Codex 0.115, the Linux
sandbox moved to bubblewrap, so WSL1 is no longer supported.
Launch VS Code from inside WSL
For step-by-step instructions, see the official VS Code WSL tutorial.
Prerequisites
- Windows with WSL installed. To install WSL, open PowerShell as an administrator, then run
wsl --install(Ubuntu is a common choice). - VS Code with the WSL extension installed.
Open VS Code from a WSL terminal
# From your WSL shell
cd ~/code/your-project
code .
This opens a WSL remote window, installs the VS Code Server if needed, and ensures integrated terminals run in Linux.
Confirm you’re connected to WSL
-
Look for the green status bar that shows
WSL: <distro>. -
Integrated terminals should display Linux paths (such as
/home/...) instead ofC:\. -
You can verify with:
echo $WSL_DISTRO_NAMEThis prints your distribution name.
If you don’t see “WSL: …” in the status bar, press Ctrl+Shift+P, pick
WSL: Reopen Folder in WSL, and keep your repository under /home/... (not
C:\) for best performance.
If the Windows app or project picker does not show your WSL repository, type
\wsl$ into the file picker or Explorer, then navigate to your
distro’s home directory.
Use Codex CLI with WSL
Run these commands from an elevated PowerShell or Windows Terminal:
# Install default Linux distribution (like Ubuntu)
wsl --install
# Start a shell inside Windows Subsystem for Linux
wsl
Then run these commands from your WSL shell:
# Install and run Codex in WSL
curl -fsSL https://chatgpt.com/codex/install.sh | sh
codex
Work on code inside WSL
- Working in Windows-mounted paths like
/mnt/c/…can be slower than working in Windows-native paths. Keep your repositories under your Linux home directory (like~/code/my-app) for faster I/O and fewer symlink and permission issues:mkdir -p ~/code && cd ~/code git clone https://github.com/your/repo.git cd repo - If you need Windows access to files, they’re under
\wsl$\Ubuntu\home<user>in Explorer.