Codex setup guide
Configure Codex CLI, pick models per plan, and check common startup and auth errors.
When Codex hangs for 30 seconds in VS Code or Cursor before failing to load its sidebar, or when the desktop app cannot find the CLI binary, the fix depends on which layer broke. Here are the verified commands for macOS, Linux, Windows, and WSL2.
Two startup errors account for most Codex setup failures across VS Code, Cursor, and the Windows desktop app. They often show up on the same machine after an update, but they come from different layers: one is a sidebar webview timeout inside the editor, and the other is a missing or unresolvable CLI executable.
Codex could not start.The extension could not start its user interface.In the extension output log, that UI error corresponds to a hardcoded 30-second timeout:
[CodexWebviewProvider] Webview renderer did not become ready... reason=renderer_ready_timeout (timeoutMs=30000)The second error appears in the desktop app or CLI-backed integrations when the host cannot locate the native executable:
Unable to locate the Codex CLI binary.Set CODEX_CLI_PATH or ensure the Electron resources include bin/codexFastest fixes: For The extension could not start its user interface, update OpenAI.chatgpt to 26.1106.51428 or later (or roll back to 26.1007.21434) and clear the editor's Service Worker cache. For Unable to locate the Codex CLI binary, reinstall @openai/codex with optional dependencies enabled, or point CODEX_CLI_PATH directly to the native codex.exe / codex binary.
Match your environment and error message below, then jump straight to the matching steps.
| Symptom and environment | Root cause | Fastest fix |
|---|---|---|
VS Code or Cursor throws could not start its user interface after an update | 30-second webview timeout regression (renderer_ready_timeout) in 26.1021.x builds | Update to 26.1106.51428+ or roll back to 26.1007.21434 and pause auto-update |
| Same UI error persists on macOS or Windows after changing versions | Stale Service Worker or WebStorage cache blocks webview bootstrap | Quit the editor completely, delete Service Worker and WebStorage, then relaunch |
| UI error happens only in Cursor or custom sidebar layouts | Secondary sidebar container conflicts with the extension webview | Run Codex: New Codex Agent from the Command Palette to open it as an editor tab |
| 30-second timeout inside a WSL2 workspace | Hanging WSL local sockets or heavy workspace initialization stalls the webview handshake | Run wsl --shutdown in PowerShell, relaunch the editor, and reload the window |
Windows Store desktop app shows Unable to locate the Codex CLI binary | App was moved to D: or E:, breaking MSIX relative paths to bundled binaries | Move the app back to C: via Windows Settings → Apps → Installed apps |
Desktop app or extension still cannot find codex | Binary path is missing or points to a .cmd wrapper (triggering spawn EINVAL) | Set CODEX_CLI_PATH or chatgpt.cliExecutable to the native binary |
| npm installation fails to locate platform binary | Optional dependencies were skipped during install, or global npm bin is missing from PATH | Run npm install -g @openai/codex --include=optional and check PATH |
This message does not mean your OpenAI account or network connection is broken. As tracked in openai/codex GitHub issues (#56655, #56691, #57032), the backend app-server starts normally, while the sidebar webview fails to report ready before the 30-second renderer_ready_timeout fires.
OpenAI shipped a fix for the 26.1021.x startup regression in stable version 26.1106.51428 (and pre-release 26.51106.51428). Check for extension updates first, then open the Command Palette (Cmd + Shift + P on macOS, Ctrl + Shift + P on Windows/Linux) and run Developer: Reload Window.
If your marketplace feed has not picked up the patched release yet, pin the known working 26.1007.21434 build from your terminal:
code --uninstall-extension OpenAI.chatgptcode --install-extension [email protected] --forceIn Cursor, replace code with cursor. After rolling back, pause auto-updates so the editor does not immediately overwrite the pinned version on restart. You can right-click the extension and uncheck Auto Update, or add this to settings.json:
{ "extensions.autoUpdate": false}Old Service Worker scripts often survive extension reinstalls and keep triggering renderer_ready_timeout even after an upgrade. Quit VS Code or Cursor completely before clearing the cache directories.
macOS (for Cursor, replace Code with Cursor):
rm -rf "$HOME/Library/Application Support/Code/Service Worker"rm -rf "$HOME/Library/Application Support/Code/WebStorage"Linux:
rm -rf "$HOME/.config/Code/Service Worker"rm -rf "$HOME/.config/Code/WebStorage"Windows PowerShell (for Cursor, replace Code with Cursor):
Remove-Item -Recurse -Force "$env:APPDATA\Code\Service Worker" -ErrorAction SilentlyContinueRemove-Item -Recurse -Force "$env:APPDATA\Code\WebStorage" -ErrorAction SilentlyContinueRemove-Item -Recurse -Force "$env:APPDATA\Code\CachedExtensionVSIXs" -ErrorAction SilentlyContinueRelaunch the editor. It will regenerate clean webview storage without touching your projects or saved settings.
In Cursor or customized VS Code layouts, the secondary sidebar container can block the extension view from mounting. Bypass the sidebar by opening the Command Palette and running:
Codex: New Codex AgentThis opens Codex inside a regular editor tab instead of the sidebar panel. You can drag the tab into a split pane next to your code.
If the 30-second timeout only occurs when attached to a WSL2 workspace, reset the WSL instance from Windows PowerShell to clear hanging sockets:
wsl --shutdownThen reopen the editor and reconnect to WSL.
This error means the desktop app or IDE extension cannot find or execute the underlying native codex / codex.exe binary. Work through the four checks below.
@openai/codex with optional dependencies and verify PATH@openai/codex distributes its platform-specific native binaries through optional dependencies. If your package manager skipped optional packages, the wrapper installs without the actual binary. Run a clean reinstall:
npm uninstall -g @openai/codexnpm install -g @openai/codex --include=optionalVerify that your global npm bin directory is on PATH and resolves the binary:
npm config get prefixwhich codexOn Windows PowerShell, run where.exe codex. If the prefix directory (typically %APPDATA%\npm on Windows, or /usr/local/bin / your nvm bin folder on macOS and Linux) is missing from PATH, add it and restart your terminal.
CODEX_CLI_PATH to the native binaryIf the desktop app still cannot find its bundled bin/codex after an update, override the lookup explicitly with CODEX_CLI_PATH.
On Windows, do not point CODEX_CLI_PATH to %APPDATA%\npm\codex.cmd. Electron throws spawn EINVAL when spawning a .cmd wrapper directly. Point it to the underlying native .exe binary instead:
$nativeBin = "$env:APPDATA\npm\node_modules\@openai\codex\node_modules\@openai\codex-win32-x64\vendor\x86_64-pc-windows-msvc\bin\codex.exe"[Environment]::SetEnvironmentVariable("CODEX_CLI_PATH", $nativeBin, "User")Sign out and back in (or reboot Windows) so the desktop app picks up the updated user environment variable.
On macOS or Linux, add the export to ~/.zshrc or ~/.bashrc:
export CODEX_CLI_PATH="$(which codex)"chatgpt.cliExecutable and WSL settings in settings.jsonWhen only the VS Code or Cursor extension fails to locate the binary, set the explicit path in settings.json:
{ "chatgpt.cliExecutable": "/usr/local/bin/codex"}If you run native Windows without WSL and hit this error after an update, check both VS Code settings and %USERPROFILE%\.codex\config.toml to ensure WSL routing is not accidentally enabled:
{ "chatgpt.runCodexInWindowsSubsystemForLinux": false}If you intentionally run Codex inside WSL2, leave that setting as true and confirm codex --version works inside your WSL shell.
C:Microsoft Store (MSIX) installations moved to a secondary drive such as D: or E: often lose relative path resolution to their bundled binaries. Open Windows Settings → Apps → Installed apps, find ChatGPT / Codex, open its menu, select Move, and relocate it back to C:.
The IDE extension is a webview wrapper around the Codex CLI. Even when an editor update breaks the sidebar panel, running codex directly in your terminal bypasses the webview timeout completely.
If you want to run Codex CLI alongside other frontier coding models under one subscription, check the Codex setup guide. With CodingPass, the Go plan starts at $10 a month, gives you access to all models from one account, and lets you compare every tier on the pricing page and usage limits reference.
CODEX_CLI_PATH on Windows cause spawn EINVAL?Because the variable points to the codex.cmd shim rather than the native codex.exe binary. Update CODEX_CLI_PATH to the .exe inside @openai/codex-win32-x64\vendor\x86_64-pc-windows-msvc\bin\codex.exe and restart the app.
Yes. Hardcoding an OS-specific absolute path in chatgpt.cliExecutable syncs that path to your other machine, where it does not exist. Either exclude chatgpt.cliExecutable from Settings Sync or set it per workspace instead of globally.
renderer_ready_timeout, is the codex CLI broken too?No. renderer_ready_timeout happens strictly inside the VS Code or Cursor webview host. You can open a terminal in your repository and run codex directly while waiting for an extension patch.
Codex CLI runs directly in your terminal without the IDE webview. Connect it to CodingPass starting at $10 a month and cancel anytime.