Setting Up Codex with Node.js on WSL (Ubuntu)
This guide walks you through installing Ubuntu via WSL on Windows, setting up Node.js, and installing the OpenAI Codex CLI.
🧰 Prerequisites
Windows 10 or 11
Administrator privileges (for installing WSL)
1. 🔧 Install Ubuntu via WSL
Open PowerShell as Administrator, then run:
This installs Ubuntu as your WSL distribution. When done, Ubuntu will launch in a new terminal window.
2. 📦 Update Ubuntu and Install Node.js
Now you're inside the Ubuntu terminal. Run the following commands to update your system and install Node.js 22:
Install Node.js from NodeSource:
Check that Node.js is installed correctly:
3. 🚀 Install OpenAI Codex CLI
Now install the Codex CLI globally using npm
:
Verify the installation:
4. 🔐 Log in to OpenAI Codex
Run the login command to authenticate:
Once authenticated, you're ready to use Codex!
✅ Done!
You’ve now:
Installed Ubuntu via WSL
Installed Node.js 22 and npm
Installed and logged into the OpenAI Codex CLI
You're all set to start coding with Codex! 🧠💻