# Install & Configure: Codex CLI: Local AI Coding Agent for your Terminal
## What This Is
OpenAI has released Codex CLI, a tool that lets developers use AI coding assistance directly in their computer's terminal. It integrates with existing ChatGPT subscriptions to help write, debug, and manage code without needing to switch to a web browser.
Source: https://github.com/openai/codex/releases
## Before You Start
Scan my workspace and analyze:
- The project language, framework, and directory structure
- Existing agent configuration (check for .claude/, .codex/, CLAUDE.md, settings.json, commands/, skills/ directories)
- Whether this repository or a similar tool is already cloned or installed
Then ask me before proceeding:
1. Do I need to configure any service credentials for this plugin (database, API keys, etc.)?
2. Should this be project-scoped or global?
## What to Implement
This is an **Agent Plugin** — typically an MCP server or capability bundle.
- Install any required npm/pip packages from the source repository
- Register the MCP server in `.claude/settings.json` under the `mcpServers` key with the correct command and args
- Configure any required environment variables or credentials
- Verify the server starts correctly by checking its expected output
## Additional Context
- Detect the user's operating system and preferred package manager (npm or Homebrew). Use `npm install -g @openai/codex` or `brew install --cask codex` to install the Codex CLI globally.
- Initiate the Codex CLI by running the `codex` command. The CLI will automatically open a browser window for the user to authenticate with their OpenAI account. Inform the user that this one-time authentication is required to link their ChatGPT plan.
- Verify the installation and authentication by executing `codex --version` to check the version, then run `codex "Write a Python script that prints 'hello world'"` to confirm the agent is connected and responding.
## Reference Implementation
```
```shell
# Install using npm
npm install -g @openai/codex
# Install using Homebrew
brew install --cask codex
```
```
## Guidelines
- Adapt everything to my existing project — do not assume a specific stack or directory layout
- Review any fetched code for safety before installing or executing it
- After setup, run a quick verification and show me a summary of exactly what was installed, where, and how to use it