ホーム AI・IT [2026 Edition] How to Use Codex CLI | Installation on Windows via Copy-Paste, An Introduction to Terminal AI You Can "Ask and Leave Alone"

[2026 Edition] How to Use Codex CLI | Installation on Windows via Copy-Paste, An Introduction to Terminal AI You Can "Ask and Leave Alone"

真鍋 千夏 真鍋 千夏 • 更新: • 公開: • 読了約 31 分
目次


"I've tried Codex, and I heard the 'CLI' version is good. But that black terminal screen is scary..." "I searched for 'codex cli', but all I find are official English documents or difficult articles for developers."

——This article is a Windows-compatible, copy-paste-ready installation guide for you.

To put it simply, installing Codex CLI takes just three copy-pasted lines and an initial login. And once it's running, it's actually "easier" than the app version.

The reason is simple: CLI means the AI sits directly at your desk. You don't need to copy and paste files; it can read, write, and fix things directly while looking at your folders. This proximity is the unique comfort of the CLI.

▼Read this too

What is Codex CLI? (Just the "differences" from the app version in 30 seconds)

nbf7d0e8c2346

What Codex itself is (= OpenAI's "work partner you can ask in Japanese") is explained in the app version article. Here, we will only cover the differences unique to the CLI.

Think of it like this.

  • App version = Like asking someone across a reception counter. It's safe, but you have to hand over the files yourself.

  • Codex CLI = Like having them sit directly at your desk. The AI can look at and touch the contents of the folder you specify to get work done.

The true nature of the CLI is an open-source Codex that runs from the terminal (the black screen where you type commands). If you have a paid ChatGPT plan, you can use it at no extra cost. There are three benefits.

  1. No copy-paste required: It reads local files as they are and fixes them directly.

  2. You can "leave it alone": You can ask it to "summarize all the notes in this folder" and go back to other work.

  3. Doesn't disrupt your workflow: You can call it only when needed, right alongside your usual folders and editors.

The image of "black screen = for pros" is outdated. All you have to do is copy and paste the command below.

Things to prepare before installation (only 3)

Preparation is minimal. Just check these three things.

  • 1. Paid ChatGPT plan (Plus, etc.). Codex CLI can be used as part of this subscription. Detailed pricing information (Is there a free tier? How much?) is covered in Codex Pricing Summary, so check that if you're curious.

  • ② Node.js (if installing via npm). Not required for "Methods B and C" described later.

  • ③ Terminal. On Windows, use "PowerShell" or "WSL (described later)"; on Mac, use "Terminal". It is already installed, so there is nothing new to prepare.

Codex CLI installation steps (Windows priority, copy-paste is fine)

There are 3 ways to install it. If you're unsure, "Method A (npm)" is fine. For those who have trouble, I have also provided B and C.

Method A: Install via npm (most common)

If you have Node.js installed, this is just one line.

npm install -g @openai/codex

If you are unsure if Node.js is installed, please check with this first.

node -v

If a version number (e.g., v22.x.x) is returned, you are good to go. If it says "command not found," Node.js is not installed. Please install the "LTS" version from the official Node.js website and then run npm install again.

Method B: Install via Homebrew (for Mac)

If you are using Homebrew on a Mac, this is easier.

brew install --cask codex
Method C: Run the installer directly (Node not required)

For those who don't want to install Node.js. Just paste this one line into the terminal.

curl -fsSL https://chatgpt.com/codex/install.sh | sh
Verify the installation

Regardless of the method, verify it at the end with this.

codex --version

If the version is displayed, the installation is complete. Great job. Up to this point, it's effectively 2-3 lines of copy-pasting.

[Important] Points where Windows users often stumble

Windows requires a few tips depending on the environment. I will be careful here.

  • First, try it as is in PowerShell. Recent versions of Codex CLI have improved native Windows support, and in most cases, it works as is.

  • If it doesn't work or is unstable, use "WSL". WSL is an official feature that runs a Linux environment within Windows. It is stable if you execute the following in PowerShell with administrator privileges, restart your PC, and then execute "Method A" within Ubuntu.

wsl --install
  • If you are told that Node.js is "missing," please remember that PowerShell and WSL are separate environments. If you want to use it on the WSL side, you need to reinstall Node.js inside WSL (Ubuntu).

Initial Startup and Sign-in

Once installed, launch it inside the folder where you want the AI to sit. For example, just move to your working folder and type this.

codex

The first time you launch it, a sign-in screen will appear. We recommend logging in with your ChatGPT account (just follow the on-screen instructions). You can use your existing paid plan as is.

  • If using it personally: ChatGPT login is fine.

  • If incorporating into automation scripts: API key method (this can be pay-as-you-go, so don't forget to set a limit).

Note that the default model used during sign-in changes depending on the version and time. If you want to switch models, you can select one by typing '/model' during a conversation. There is no need to worry about "which is the latest recommended model?"

The Most Important Tip for "How to Ask"

This is the turning point for whether you can use the CLI comfortably. Remember just one thing.

"Give me options first" rather than "Just do it."

If you suddenly dump a task like "organize this folder" on it, you will end up with more rework when it deviates from your intent. Start by asking like this.

このフォルダの中身を確認して、何ができそうか
"実行はせずに" 候補だけ3つ挙げてください。

If the approach is correct, proceed by saying, "Okay, do number 1." This alone will significantly reduce accidents. Once you get used to it, these "leave it to the AI" requests will become effective.

このフォルダの .txt を全部読んで、それぞれ3行で要約した
summary.md を新しく作ってください。
このコードのエラーを直して。何を変えたかは日本語で
1行ずつ説明してください。

The strength of the CLI is that you don't have to be glued to the screen the whole time. You can ask it, and go back to other work.

Eliminating the fear of "what if it runs on its own and breaks something" (Safety Settings)

Since the CLI can directly touch the contents of the specified folder, it is reassuring to just grasp the initial safety settings. It's not difficult.

  • The default is "only within the working folder": By default, Codex CLI will not rewrite anything outside the folder where it was launched.

  • Do not use full access: The official documentation explicitly states that the "can execute anything" setting (danger-full-access) "increases the risk of data loss or leakage." The iron rule is not to use it outside of isolated environments like Docker.

  • Do not open confidential folders in the first place: Do not launch 'codex' in a folder containing customer lists or accounting data. This alone prevents most risks.

For those who want even more peace of mind: If you place an AGENTS.md file (a file where you write "request rules" for Codex) in your working folder, it will read this policy every time before it acts. You can create a template by typing '/init' after launching codex. The content only needs to be a few lines, for example:

# Codexへのルール
- 説明・確認・要約は、常に日本語で行う。
- ファイル削除・上書き・大規模な置換の前は、必ず日本語で
  「何を・どこまで・戻し方」を説明して確認する。
- コマンドを実行する前に、目的を日本語で1行だけ実況する。

The final "give me a live commentary of just one line" is surprisingly effective. The eeriness of mysterious commands running silently disappears, and you can see "what it is trying to do now" in Japanese.

Common Pitfalls and Troubleshooting

I will summarize the points where you are likely to get stuck during installation in advance.

  • Told that codex cannot be found → Immediately after installation, it often works if you close the terminal once and reopen it. If that still doesn't work, check if it is installed with codex --version.

  • Unstable on Windows → Switch to the "WSL" route above.

  • Told that node is missing → If you switch to "Method C (Installer)," you can proceed without Node.js.

  • Hitting the limit immediately → The CLI also shares the usage limit of the paid plan. If you break down the tasks you ask into smaller pieces, you will be less likely to hit the limit.

  • Official documentation is all in English → The fastest solution is to paste the error message directly into Codex (or ChatGPT) and ask, "Tell me the meaning and how to deal with this in Japanese."

CLI vs. App: Which one should you use? (How to choose your entry point)

Codex has multiple entry points. Here is a rough guide on what they are suited for.

  • Desktop App: For those who want to try it out first / want to proceed while checking the screen. → How to use it is here.

  • Codex CLI (this article): For those who want to entrust the contents of a folder directly / want to ask and leave it alone.

  • Both work with the same account, so you can use them together, such as "using the app for daily tasks and the CLI for bulk work."

"Get a feel for it with the app first, and come to the CLI when you feel it's not enough"—this order is the least likely to cause you to get stuck.

Codex CLI Frequently Asked Questions (Q&A)

Q. How do you pronounce Codex? A. It is pronounced "Ko-deks." CLI is pronounced "C-L-I" (Command Line Interface).

Q. Can non-engineers use Codex CLI? A. Yes, they can. The steps in this article are written so that you can complete it by copy-pasting even if you don't know the meaning of the commands. The terminal is a case of "learning by doing," and it won't be scary after 30 minutes of playing with it.

Q. Can I use it for free? A. Codex CLI is basically provided as part of ChatGPT's paid plan. Since the availability of a free tier and its limits change depending on the time and region, please check the latest conditions in the pricing summary and the official website.

Q. Is Node.js absolutely necessary? A. No. You can install it without Node.js using "Method C (Installer)" or "Method B (Homebrew)" on Mac.

Q. Which is better, Codex CLI or Claude Code? A. As of 2026, rather than choosing "one or the other," they have different strengths, so it is practical to use them for different purposes. The general consensus is that if you want to delegate repetitive tasks, go with Codex, and for deep design and reviews, use the other.

Q. It behaved strangely after I asked it to do something A. First, stay calm. If you add "provide a one-line live commentary in Japanese before execution" to AGENTS.md, it will be less likely to go rogue. If you are still worried, keep full access OFF and try it by breaking your work folder into smaller sections.

Conclusion

Codex CLI is a tool that, once you get past the assumption that "black screens are for pros," is actually more hands-off and easier than the app version . All you have to do is copy and paste the command and ask in Japanese, "Show me the options first."

If you haven't touched the app version yet, starting with the basic usage of Codex will make the content of this article a natural continuation.

▼ List of ChatGPT Work & Codex Articles ▼


The author of this article, Tomoyuki Komine, is currently accepting article production work as an SEO writer.

My own note gets 50,000 monthly PVs (about 70% from search traffic), and I have experience producing over 1,000 SEO articles. I can handle everything from keyword selection to structure, writing, WordPress entry, and post-publication improvements.

In particular, I welcome ongoing writing requests from IT, AI, and business SaaS owned media (rate per character 1.5 to 2.5 yen / negotiable, available for 20-30 hours per week).

▼ Click here for scope of work, track record, and request process

I also welcome consultations at the stage of "Can I ask you to do this for our company's media?" Please feel free to contact me via note, X DM, or email [t.facilita@gmail.com].

同じカテゴリの記事

真鍋 千夏
デジタルマーケター 真鍋 千夏
プロフィールを見る →

美容と暮らしの話題を担当。メーカーの公式発表、商品成分の公表資料、専門家の監修記事をもとに事実を整理します。

おすすめの関連記事