# Installing and configuring Codex: step by step | llmnet Apps

[← Apps overview](/en/)

# Codex: installing and configuring

By Ivo Donker · October 28, 2026 — created with AI assistance (writer: DeepSeek V4.1 Flash; critic: Gemini 3.8 Flash + gpt-oss-120b via Groq)

Codex: [Review](/en/codex-review)[Install & set up](/en/codex-installatie)[News](/en/codex-nieuws)[Technical tutorial](/en/codex-tutorial)

As of September 2026, compiled from our own notes and news archive; text machine-generated and editorially checked. Check versions and commands in the official documentation.

In this guide you install Codex CLI, OpenAI's coding agent for the terminal, on macOS, Linux or Windows. You log in, choose a model and a safety level, and check that everything works. The commands come from the official documentation and OpenAI's repository (as of September 2026).

## What you need

- Operating system: macOS, Linux or Windows. On Windows, Codex can run natively in PowerShell or within WSL 2.

- Account: a ChatGPT account with Codex access, or an OpenAI API key. With a subscription, your plan's usage limits apply; with an API key, you pay per token.

- Linux/WSL 2: the bubblewrap package for the sandbox (see below).

## Installing on macOS and Linux

The official installer:

curl -fsSL https://chatgpt.com/codex/install.sh | sh
Alternatives:

brew install --cask codex # Homebrew
npm install -g @openai/codex # npm
You can also download a ready-made binary from the GitHub releases page for openai/codex, for example codex-aarch64-apple-darwin.tar.gz for a Mac with an Apple chip.

Then check:

codex --version

## Installing on Windows

In PowerShell:

irm https://chatgpt.com/codex/install.ps1 | iex
If you mainly work with Linux tools, install Codex in WSL 2 using the Linux command above. In both places Codex uses a sandbox: the native Windows sandbox in PowerShell, the Linux sandbox in WSL 2.

## Logging in

Start Codex in your project directory:

cd ~/mijn-project
codex
On first start, you choose between logging in with your ChatGPT account or an API key. If you want to work with a key, put it in the OPENAI_API_KEY environment variable and never commit it.

## Sandbox on Linux

On macOS the sandbox works immediately (via Seatbelt). On Linux and WSL 2, Codex needs bubblewrap:

sudo apt-get install bubblewrap # Debian/Ubuntu
sudo dnf install bubblewrap # Fedora

## The first settings that matter

1. Choose a model. Type /model in the session. As of September 2026, OpenAI recommends three models:

- gpt-6-sol: for complex programming work and agent tasks.

- gpt-6-luna: the most economical model, for many small, targeted tasks.

- gpt-6-astra: the heaviest model, for the most difficult work.

In the same menu you also set the reasoning level. The older gpt-5.5 disappears on 14 October 2026 for those who log in with a ChatGPT account.

2. Choose a safety level. Codex combines a sandbox with an approval policy. For beginners, this is the sensible combination:

codex --sandbox workspace-write --ask-for-approval on-request
Codex may then edit files in your project and run ordinary commands, but it asks first for everything outside that, such as internet access. If you only want it to observe, use --sandbox read-only.

3. Record the settings. Put your choices in ~/.codex/config.toml, then you don't have to specify them every time:

model = "gpt-6-sol"
approval_policy = "on-request"
sandbox_mode = "workspace-write"
4. Provide project instructions. Create an AGENTS.md in the root of your project with build commands, test commands and conventions. Codex reads that file in every session.

# AGENTS.md
- Build: `npm run build`
- Tests: `npm test` — draai ze voor elke commit
- Wijzig niets buiten `src/` zonder te vragen

## Checking whether it works

A one-off, harmless command without an interactive session:

codex exec "Leg in drie zinnen uit wat dit project doet."
If a sensible answer comes back, then installation and login are working.

## Updating

- Official installer: run the installation command again.

- Homebrew: brew upgrade --cask codex.

- npm: npm install -g @openai/codex@latest.

Update regularly. In September 2026, fixes appeared for two sandbox escapes, Heapjack and Overpatch; use at least CLI version 0.149.0.
