Skip to content

Commit 5d5b89e

Browse files
authored
Merge pull request #2699 from JoeStech/codex-cli-install-guide
Codex CLI install guide
2 parents 7bf2895 + ff2e6f3 commit 5d5b89e

2 files changed

Lines changed: 239 additions & 4 deletions

File tree

Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
---
2+
title: Codex CLI
3+
draft: true
4+
author: Joe Stech
5+
minutes_to_complete: 10
6+
official_docs: https://developers.openai.com/codex/cli/
7+
8+
test_maintenance: true
9+
test_images:
10+
- ubuntu:latest
11+
12+
layout: installtoolsall
13+
multi_install: false
14+
multitool_install_part: false
15+
tool_install: true
16+
weight: 1
17+
---
18+
19+
Codex CLI is a lightweight coding agent from OpenAI that runs locally in your terminal. It can help you with coding tasks, understand your codebase, run commands, and assist with development workflows.
20+
21+
It supports multiple operating systems, including Arm-based Linux distributions and macOS.
22+
23+
## What should I do before installing Codex CLI?
24+
25+
You need an OpenAI account to use Codex CLI. You can either sign in with your ChatGPT account (Plus, Pro, Team, Edu, or Enterprise plan) or use an OpenAI API key.
26+
27+
Codex CLI requires Node.js 18 or later.
28+
29+
This guide explains how to install Codex CLI on macOS and Arm Linux.
30+
31+
## How do I download and install Codex CLI?
32+
33+
On most systems, you should install codex using `npm`. On macOS Homebrew can also be used.
34+
35+
### How do I use npm to install Codex CLI?
36+
37+
The easiest way to install Codex CLI is with npm:
38+
39+
```console
40+
npm install -g @openai/codex
41+
```
42+
43+
### Can I use Homebrew to install Codex CLI on macOS?
44+
45+
Yes, you can install [Homebrew](https://brew.sh/) if it's not already available on your computer.
46+
47+
Install Codex CLI using Homebrew:
48+
49+
```console
50+
brew install --cask codex
51+
```
52+
53+
## How do I install Codex CLI on Arm Linux?
54+
55+
You can install Codex CLI on Arm Linux distributions using npm. This method works on all major Arm Linux distributions including Ubuntu, Debian, CentOS, and others.
56+
57+
### What packages do I need before installing Codex CLI on Arm Linux?
58+
59+
Before installing Codex CLI, install prerequisite packages and Node.js.
60+
61+
Install the required packages on Ubuntu/Debian systems:
62+
63+
```bash
64+
sudo apt update && sudo apt install -y curl
65+
```
66+
67+
If you are not using Ubuntu/Debian use your package manager to install curl.
68+
69+
### How do I install Node.js on Arm Linux?
70+
71+
Codex CLI requires Node.js version 18 or higher. The easiest way to install Node.js on Arm Linux is using the NodeSource repository.
72+
73+
Download and run the Node.js 22.x setup script:
74+
75+
```bash
76+
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
77+
```
78+
79+
Install Node.js:
80+
81+
```bash
82+
sudo apt install nodejs -y
83+
```
84+
85+
Verify Node.js is installed correctly:
86+
87+
```bash
88+
node --version
89+
```
90+
91+
The output should show version 18 or higher:
92+
93+
```output
94+
v22.21.0
95+
```
96+
97+
Verify npm is available:
98+
99+
```bash
100+
npm --version
101+
```
102+
103+
The output shows the npm version:
104+
105+
```output
106+
10.9.4
107+
```
108+
109+
### How do I install Codex CLI using npm on Arm Linux?
110+
111+
With Node.js installed, install Codex CLI globally using npm.
112+
113+
Install Codex CLI globally:
114+
115+
```bash
116+
sudo npm install -g @openai/codex
117+
```
118+
119+
This downloads and installs the latest version of Codex CLI.
120+
121+
### How do I confirm Codex CLI is working?
122+
123+
You now have the latest version of Codex CLI installed.
124+
125+
Confirm the CLI is available by printing the version:
126+
127+
```console
128+
codex --version
129+
```
130+
131+
The output shows the version:
132+
133+
```output
134+
@openai/codex, 0.77.0
135+
```
136+
137+
### How do I authenticate with OpenAI?
138+
139+
There are two ways to authenticate with Codex CLI.
140+
141+
**Option 1: Sign in with ChatGPT**
142+
143+
Run the `codex` command and select **Sign in with ChatGPT** to authenticate:
144+
145+
```console
146+
codex
147+
```
148+
149+
Follow the prompts to sign in with your OpenAI account. This is recommended if you have a ChatGPT Plus, Pro, Team, Edu, or Enterprise plan.
150+
151+
**Option 2: Use an OpenAI API key**
152+
153+
You can also use an OpenAI API key for authentication. This is useful for developers who prefer API-based access or need to use Codex in automated workflows.
154+
155+
Set the `OPENAI_API_KEY` environment variable:
156+
157+
```console
158+
export OPENAI_API_KEY=your-api-key-here
159+
```
160+
161+
To make this permanent, add the export command to your shell configuration file (such as `~/.bashrc` or `~/.zshrc`).
162+
163+
You can generate an API key from the [OpenAI Platform](https://platform.openai.com/api-keys).
164+
165+
{{% notice Note %}}
166+
When using an API key, usage is billed to your OpenAI API account rather than being included in your ChatGPT subscription.
167+
{{% /notice %}}
168+
169+
## How do I configure Codex CLI?
170+
171+
Codex CLI stores preferences in `~/.codex/config.toml`.
172+
173+
You can configure various options including the default model, approval mode, and MCP servers.
174+
175+
To see all configuration options, refer to the [Configuration documentation](https://developers.openai.com/codex/cli/reference/).
176+
177+
178+
## Install a local MCP server
179+
180+
The Arm MCP Server is an MCP server providing AI assistants with tools and knowledge for Arm architecture development, migration, and optimization. This section shows how to configure the Arm MCP server locally using Docker.
181+
182+
First, pull the MCP server image to your local machine:
183+
184+
```console
185+
docker pull armlimited/arm-mcp:latest
186+
```
187+
188+
You also need Docker running on the system. See the [Docker install guide](/install-guides/docker/) for instructions.
189+
190+
### How do I configure the Arm MCP server?
191+
192+
Codex CLI uses a TOML configuration file for MCP servers. Modify the file `~/.codex/config.toml` to add the Arm MCP server via a Docker container.
193+
194+
To analyze a local codebase, use a `-v` argument to mount a volume to the Arm MCP server `/workspace` folder so it can access code you want to analyze with migrate-ease and other tools.
195+
196+
Replace the path `/Users/yourname01/yourlocalcodebase` with the path to your local codebase.
197+
198+
Add the following to your `~/.codex/config.toml` file:
199+
200+
```toml
201+
[mcp_servers.arm-mcp]
202+
command = "docker"
203+
args = [
204+
"run",
205+
"--rm",
206+
"-i",
207+
"-v", "/Users/yourname01/yourlocalcodebase:/workspace",
208+
"--name", "arm-mcp",
209+
"armlimited/arm-mcp:latest"
210+
]
211+
startup_timeout_sec = 60
212+
```
213+
214+
{{% notice Note %}}
215+
The section must be named `mcp_servers` with an underscore. Using `mcp-servers` or `mcpservers` will cause Codex to ignore the configuration.
216+
{{% /notice %}}
217+
218+
### How do I verify the Arm MCP server is working?
219+
220+
Start Codex CLI and list the tools from the MCP server to verify it is working:
221+
222+
```console
223+
codex
224+
```
225+
226+
Use the `/mcp` command to view active MCP servers and their status:
227+
228+
```console
229+
/mcp
230+
```
231+
232+
You should see the Arm MCP server listed. If the arm-mcp server says it's still loading, wait a moment and check again.
233+
234+
You can also verify the tools are available by asking Codex to list the available Arm MCP tools.
235+
236+
If you are facing issues or have questions, reach out to mcpserver@arm.com.
237+
238+
You're ready to use Codex CLI with Arm development tools.

content/learning-paths/servers-and-cloud-computing/arm-mcp-server/1-overview.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ The required configuration steps vary by AI coding assistant. Refer to the insta
9292
- [GitHub Copilot](/install-guides/github-copilot/)
9393
- [Gemini CLI](/install-guides/gemini/)
9494
- [Kiro CLI](/install-guides/kiro-cli/)
95-
96-
## What you've accomplished and what's next
97-
98-
In this section, you've learned about the Arm MCP Server and its available tools for migration and optimization. You've also seen the different ways to interact with it: direct AI chat, prompt files, and agentic workflows.
95+
- [Codex CLI](/install-guides/codex-cli/)
9996

10097
In the next section, you'll use direct AI chat with the Arm MCP Server to check Docker base images for Arm compatibility.

0 commit comments

Comments
 (0)