To install OpenAI Codex CLI on Linux, use the npm method. The official Codex docs say the CLI supports Linux, can be installed with npm, and starts with the codex command. The first run prompts you to sign in with your ChatGPT account or an API key. (OpenAI Developers)
1. Install Node.js and npm
For Ubuntu/Debian:
sudo apt update
sudo apt install -y nodejs npm git
Check:
node -v
npm -v
2. Install Codex CLI
sudo npm i -g @openai/codex
Official install command:
npm i -g @openai/codex
I used sudo above because many Linux systems require admin permission for global npm installs.
3. Run Codex
Go to your project folder:
cd /path/to/your/project
Start Codex:
codex
On first run, it will ask you to sign in using your ChatGPT account or an OpenAI API key. (OpenAI Developers)
4. Upgrade later
sudo npm i -g @openai/codex@latest
That is the official upgrade command for npm installs. (OpenAI Developers)
Common errors
If you get:
codex: command not found
Try:
npm bin -g
Then make sure that global npm path is in your PATH.
If install fails with permission errors, use:
sudo npm i -g @openai/codex
or install Node through a user-level Node manager and then run npm without sudo.
Important note
On Linux, use Codex CLI. The official Codex desktop app is currently listed for macOS and Windows, while the CLI is the Linux-supported option. (OpenAI Developers)
The article does a great job explaining Linux-specific installation methods across Ubuntu, Fedora, and Arch distributions. The inclusion of troubleshooting guidance adds strong practical value.
Great tutorial for Linux users exploring Codex CLI. The structured installation process helps beginners complete the setup without confusion.
Helpful Linux installation guide for Codex CLI—easy to follow and very useful for developers setting up their coding environment on Linux systems.
Great tutorial for Linux users. The installation methods are well-structured and helpful for both beginners and experienced developers.