Skip to content

Install Codex CLI in WSL on Windows

Install Codex CLI inside WSL, keep its configuration and projects in Linux, authenticate safely, and connect a Responses-compatible model provider.

MGMCSA Guru Team August 10, 2026 2 min read
Codex CLI running inside WSL on Windows

Run Codex inside WSL when the repository and the rest of your toolchain are already in Linux. The Windows and WSL installations are separate. A Windows Codex executable does not supply the command, configuration, or credentials inside Ubuntu.

Prepare WSL

Install WSL and a Linux distribution, then update its packages. Keep an active repository under a path such as ~/projects/my-app when possible. File-heavy agent work is usually slower across /mnt/c.

Install Codex inside Linux

Follow the current installation command in the official Codex repository. Run the installer inside WSL, then open a new shell and confirm that the command is available:

codex --version

Installation methods can change. Avoid copying an old package command when the official repository documents a different current release method.

Keep configuration in the WSL home

The main configuration path is:

~/.codex/config.toml

Keep this file in the Linux home directory. Do not point the WSL installation at the Windows .codex directory unless you understand which client will modify it.

Authenticate or add a provider

Use the official sign-in flow for OpenAI-backed Codex. For another provider, follow that provider’s current Codex integration guide. A provider must match Codex’s expected API protocol and tool behavior; an OpenAI-style base URL alone does not prove compatibility.

DeepSeek’s current Codex setup uses the Responses API, wire_api = "responses", and a custom models.json catalog. See DeepSeek V4 with Codex for the complete configuration.

Start from the repository

cd ~/projects/my-app
codex

Begin with a read-only request. Confirm the selected model and provider in the startup information or provider usage records before allowing edits.

Common problems

  • codex is missing: install it inside the current WSL distribution and open a new shell.
  • Configuration changes do not apply: confirm that you edited the Linux ~/.codex/config.toml, then restart Codex.
  • The provider returns a protocol error: compare wire_api, base URL, and model catalog with the provider’s current Codex guide.
  • File operations are slow: move the active repository from /mnt/c to the Linux home directory.
  • The Windows app and WSL CLI behave differently: they may be reading different configuration directories.

Codex in WSL checklist

  • Codex installed inside the WSL distribution
  • Configuration stored under the Linux home directory
  • Existing Codex files backed up before provider changes
  • Active repository kept in Linux when practical
  • Read-only request tested before edits

Frequently asked questions

Should I run Codex CLI in WSL?

WSL is useful when your project and development tools already run in Linux. Install Codex inside that distribution so its executable, shell, configuration, and project files share one environment.

Where is the Codex configuration in WSL?

Codex uses ~/.codex/config.toml in the Linux home directory. A custom model catalog may also live under ~/.codex.

Can Codex in WSL use a third-party provider?

Yes, when the provider implements the protocol and Codex features your configuration expects. Current DeepSeek instructions use its Responses API, a model provider block, and a custom models.json catalog.

Should the repository live under /mnt/c?

Repositories with frequent file operations usually run faster in the WSL Linux file system. Keep active work under your Linux home when Windows applications do not need direct file access.

Sources & further reading

Official vendor documentation referenced while writing this guide.

MG

MCSA Guru Team

IT & Systems Administration

We are working IT pros and system administrators who spend our days in Windows Server, Microsoft 365, and the wider Microsoft stack. MCSA Guru is where we write down the fixes and walkthroughs we wish we had found the first time.

MCSA Guru provides independent, educational IT guidance. Microsoft, Windows, Windows Server, Microsoft 365, Exchange, and Microsoft Teams are trademarks of Microsoft Corporation; Docker is a trademark of Docker, Inc. MCSA Guru is not affiliated with or endorsed by Microsoft or Docker. Always test changes in a safe environment before applying them in production.

Related guides

Fixing something right now?

Jump straight into the guide library or search for the exact error or task you are dealing with.