ホーム 暮らし Codex Utilization Guide Part 1: CLI Edition / Preparation for Getting Started

Codex Utilization Guide Part 1: CLI Edition / Preparation for Getting Started

東條 淳平 東條 淳平 • 更新: • 公開: • 読了約 16 分
目次

The era where AI builds apps for us has truly arrived

n64369671436b

OpenAI's "Codex" has been a hot topic lately.
I heard that "AI can write programs on its own" and got interested, but I didn't really understand it.
However, I need to start using AI agents sooner or later.
So, I decided to write an article starting from how to get started with Codex, partly for my own learning.

Two types of Codex: App version and CLI version

There are two ways to use Codex: the App version (Desktop App) and the CLI version (Command Line Interface).
The biggest difference between the two is the visual nature of the operations and the scope of PC automation support.
The App version allows you to intuitively review and manage AI agent tasks through a visual interface (GUI), while the CLI version is designed for speed, automation, and customizability on the terminal.

Which Codex should you choose?

For those who aren't necessarily engineers and just want to use it with intuitive operations, the App version is definitely recommended.
The CLI version has a sense of speed, allowing you to build things quickly with a single command. Even though it's a command line, you can proceed with inputs through Japanese conversation just like ChatGPT, and you can also drag and drop files like images into the command line.
In this article, we will start with the CLI version as an introduction.

How to get started with the Codex CLI version

I had absolutely no prior knowledge, so even to get started, I was thinking:

  • What do I need to install?

  • I haven't touched a command line in years...

  • What is PowerShell?

That was the state I was in.

This time, I will summarize from a beginner's perspective how I, with that background, ran the Codex CLI on a Windows PC and completed my first app.

In this article, I use "an app that performs OCR on PDFs to create text for RAG" as the subject, but these preparation steps are common to any app development.

First, what you need

The first things I installed were the following three:

  • Python

  • Node.js

In addition, since the goal this time was to build an OCR app,

  • Tesseract OCR

The Codex CLI itself is installed via Node.js.

What is PowerShell?

You can think of PowerShell as the Windows version of the command line.
If you used MS-DOS in the past, you might feel a sense of nostalgia while also finding it a bit tedious, but the commands you will use are limited to just a few, such as
cd
,
mkdir
,
python, codex, and so on.

Steps to open it from the Start menu

1. Press the Windows key.
2. Type "PowerShell".
3. Click "Windows PowerShell" or "PowerShell".

Installing Python (approx. 5 minutes)

Download the latest version of Python from the official website. https://www.python.org/downloads/

During installation, make sure to check this one thing.

✅ Add python.exe to PATH

If you forget this, it will be troublesome later.
After installation, in PowerShell, type

python --version

and if it displays something like

Python 3.13.x

then you are good to go.

Installing Node.js (approx. 5 minutes)

Official website
https://nodejs.org/

Install the LTS version.

In PowerShell, run

node -v
npm -v

.

v24.2.0
11.4.2

If version information such as this is displayed, it is a success.



Installing Tesseract OCR

This is necessary if you want to use OCR.
Tesseract OCR is an open-source optical character recognition (OCR) engine developed and supported by Google. It supports over 100 languages and can extract text from images and PDF files with high accuracy. T It is free and can be used completely offline, making it ideal for data extraction in environments where privacy is protected.

For Windows, you can use the installer provided by the Mannheim University Library in Germany. The Mannheim University Library uses Tesseract for character recognition of historical newspapers.

Access the following page to download the installer for Windows. There are 32-bit and 64-bit versions; we will download the 64-bit version this time.

Home · UB-Mannheim/tesseract Wiki · GitHub

After installation,

tesseract --version

did not work, which made me panic. The cause was that

C:\Program Files\Tesseract-OCR

was not in the PATH.
Adding it to the Windows environment variables solved the issue.

Steps to add PATH to environment variables

1. Type "environment variables" in the Windows Start menu.
Then, click on the item that appears called "Edit the system environment variables".

2. Click "Environment Variables".
Press the "Environment Variables (N)..." button at the bottom of the screen.

3. Edit Path.
Select "Path" from the "User variables" list at the top and click "Edit".
(If you have administrator privileges, you may add it to the Path in "System variables" instead.)

4. Add new.
Click "New" and enter the following path:
C:\Program Files\Tesseract-OCR
Press OK to save.

5. Reopen PowerShell.
Close PowerShell once and open it again.

6. Verify operation
Finally, run

tesseract --version

and if it displays

tesseract v5.x.x

like this, it is a success.

Install Codex CLI

To install, simply enter the following into the PowerShell command line.

npm.cmd install -g @openai/codex

Just type it in.

I performed the verification with

codex.cmd --version

.

Since the PowerShell execution policy is involved here as well, when launching Codex, I am entering

codex.cmd

in addition to Codex.

The following is a copy of the screen text when I installed Codex.

Visual Studio 2026 Developer PowerShell v18.7.1 Copyright (c) 2026 Microsoft Corporation PS C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools> npm.cmd install -g @openai/codex

added 2 packages in 5s npm notice npm notice New minor version of npm available! 11.13.0 -> 11.17.0 npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.17.0 npm notice To update run: npm install -g npm@11.17.0 npm notice

PS C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools>


Next, enter the command to check the version of the installed Codex, and if the version information is displayed, the Codex CLI is ready to use.

PS C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools> codex.cmd --version
codex-cli 0.141.0

Creating your first project

I am finally going to create an app.
Stay tuned.

同じカテゴリの記事

東條 淳平

スポーツと芸能が交差する話題を担当。大会公式記録と所属先の発表を突き合わせ、数字は必ず出典付きで扱います。

おすすめの関連記事