Integrating VS Code + Codex (OpenAI)
A practical setup guide (extensions, install steps, and best-practice workflow)
If you live in VS Code, Codex is one of the nicest ways to bring an “agentic” coding assistant into your daily workflow—so you can ask for changes, refactors, bug fixes, and explanations inside the editor, with Codex able to read your project, edit files, and (optionally) run commands.
Below is a simple, reliable setup that works well for real projects—plus the extensions you actually need.
What you’re integrating (quick mental model)
There are two pieces that work together:
- Codex IDE Extension – adds Codex inside VS Code (sidebar + editor workflow).
- Codex CLI – the local “engine” that can read/change/run code in the current directory (and the IDE extension shares config with it).
Think of it like: VS Code = cockpit, Codex = copilot + wrench.
Prerequisites
Works best on macOS / Linux
OpenAI notes that Windows support for the Codex VS Code extension is experimental, and recommends using WSL for the best experience.
If you’re on Windows, don’t worry—this guide includes the clean WSL path.
Step 1 — Install the required VS Code extensions
✅ Must-have
- Codex IDE extension (OpenAI) – the main integration for Codex inside VS Code.
✅ Windows users (recommended)
- WSL extension (Microsoft) – lets VS Code open your Linux workspace seamlessly.
Optional (but super useful)
- ESLint + Prettier (JS/TS), or language equivalents (Java Checkstyle, Python Ruff, etc.)
- GitLens (faster review of what changed)
Step 2 — Install Codex CLI (recommended even if you only want the VS Code UI)
Codex CLI is supported on macOS, Windows, and Linux, and is the shared foundation for configuration.
Install with npm
npm install -g @openai/codex
(Alternative: Homebrew install is also documented.)
Then run:
codex
You’ll be prompted to sign in with your ChatGPT account or an API key.
Step 3 — Install the Codex extension in VS Code
- Open VS Code
- Go to Extensions
- Search “Codex IDE extension” / “Codex” (publisher: OpenAI)
- Install
- Restart VS Code if you don’t see it immediately in the sidebar.
Once installed, you’ll find Codex in the left sidebar, and it uses the same agent foundation as the CLI.
Step 4 — Windows setup (the clean, reliable way): run Codex in WSL
If you’re on Windows, OpenAI’s recommended workflow is:
- Install WSL (example command from an elevated PowerShell): wsl –install
- Install VS Code WSL extension
- Open your project from inside WSL: cd ~/code/your-project
code .
This opens a “WSL remote” VS Code window and ensures terminals and tooling run in Linux.
Step 5 — Configure Codex behavior (models, approvals, safety)
Codex settings are shared through a config file at:
~/.codex/config.toml
This is where you tune things like:
- default model
- how/when Codex asks for approval
- sandbox and execution preferences
Step 6 — A workflow that actually works on real repos
Here’s how to get predictable results:
1) Open the repo folder (not random files)
Codex performs best when it can see the project structure.
2) Start with “orientation” prompts
Try:
- “Explain the architecture and main entrypoints.”
- “Find where authentication is implemented and map the request flow.”
- “Run tests and summarize failures.”
3) Make changes in small, reviewable slices
Ask for:
- “Implement feature X with minimal changes.”
- “Add tests for Y.”
- “Refactor module Z, but keep behavior identical.”
4) Review diffs like you would with a teammate
Before you accept a big sweep of edits, use Git:
git statusgit diff- commit checkpoints
Bonus: “Work with Apps” VSIX install (for VS Code forks like VSCodium)
If you’re using VSCodium/Windsurf/Cursor variants, OpenAI also provides a VSIX sideload approach (“Extensions: Install from VSIX…”).
Common gotchas (and quick fixes)
- Codex panel not showing: restart VS Code after installing.
- Windows feels flaky: use a WSL workspace (recommended by OpenAI).
- It edits too much: tighten the prompt (“only change files in /src/auth”, “no refactors”, “one commit worth of changes”).
Wrap-up
Once VS Code + Codex is wired in, you get a smooth loop:
Ask → Codex edits + runs → you review diffs → commit.
If you tell me your stack (React/Node, Spring Boot, Python, etc.) and whether you’re on Windows native or WSL, I’ll tailor a “recommended extension pack + Codex prompt templates” for that exact setup.

