ホーム AI・IT For IT Beginners: Installing and Getting Started with OpenAI Codex on Windows

For IT Beginners: Installing and Getting Started with OpenAI Codex on Windows

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

1. Introduction

n14c28f41a69d

By following this article from top to bottom, you can set up WSL 2 and Ubuntu on Windows and create an environment where you can launch the OpenAI Codex CLI from a practice folder. All necessary commands are provided in a copyable format.

Codex is an AI that assists with creating, explaining, fixing, and reviewing code. While you primarily interact with standard ChatGPT through a chat screen, the Codex CLI is launched from a terminal, allowing you to check files in your working folder, and perform edits or execute commands within permitted limits. CLI stands for Command Line Interface, a system operated by text commands rather than on-screen buttons. You can check the features and basic operations at OpenAI Official "Codex CLI".

You can give instructions in Japanese such as "Please explain this code" or "Please investigate the cause of this error." However, Codex is not always correct. Since it may contain incorrect content or unintended changes, humans must always verify the generated results, executed commands, and file changes.

2. Purpose of using Codex

The purpose of using Codex is not to eliminate human judgment, but to make development work easier. The basic relationship is that humans think about the goals and requirements, and Codex helps with the work.

  • Reduce time spent on code creation and modification

  • Ask questions about code you don't understand

  • Investigate the cause of errors

  • Create a draft for implementation

  • Streamline repetitive tasks

  • Understand the contents of existing projects

  • Create READMEs and procedure manuals

  • Create test code

3. What you can do with Codex

You can ask Codex to create or fix code, investigate error causes, explain code, create READMEs, create test code, perform code reviews, and automate routine tasks. You can also create drafts for IaC code such as Terraform. IaC is a method of managing cloud configurations and the like using code.

For example, you can give specific instructions like the following:

  • Please explain the structure of this folder for a beginner

  • Do not change the files, just explain the current processing content

  • Please investigate the cause of this error.

  • Please create a draft for the README.md file.

  • Please add beginner-friendly comments to this code.

  • Please check for any potentially problematic areas.

  • Please create a simple draft for a web page.

  • Please create a draft of Terraform code to manage an AWS configuration.

4. Things to prepare before using Codex

  • A Windows 10 or Windows 11 PC (Windows 11 is the recommended environment for this article)

  • Internet connection

  • OpenAI account

  • A ChatGPT plan that allows the use of Codex

  • Windows administrator privileges

  • About 30 to 60 minutes of work time

  • The ability to restart your PC

  • A folder that can be used for practice

ChatGPT plans that allow the use of Codex

As of August 2, 2026, the official OpenAI help page 'Using Codex with your ChatGPT plan' states that Codex is included in ChatGPT Plus, Pro, Business, Enterprise, and Edu. Furthermore, it is also available for a limited time in Free and Go. Therefore, at this moment, it is not the case that 'you must pay to use Codex.' However, usage limits and conditions for additional credits vary by plan.

  • Free: A free plan for individuals. Codex is available for a limited time. There is a limit to usage, and the terms of service may change or end.

  • Go: A plan for individuals offered in eligible regions. Codex is available for a limited time and has usage limits.

  • Plus: A paid plan for individuals. Includes Codex.

  • Pro: A higher-tier paid plan for individuals. Includes Codex, but differs from Plus in terms of usage limits and other features.

  • Business: A paid workspace for companies and teams. Includes Codex, but you must check administrator settings, assigned seats, usage limits, and internal company policies. An overview of the contract can be found in the official OpenAI help article 'What is ChatGPT Business?'.

  • Enterprise/Edu: A contract plan for corporations or educational institutions. Availability and features depend on the contract terms and the settings configured by the workspace administrator.

Usage via a ChatGPT account and usage via an OpenAI API key have separate billing mechanisms. API usage fees are not included in the ChatGPT subscription fee. In this article, we will log in using "Sign in with ChatGPT" without preparing an API key. For differences in authentication methods, please refer to the official OpenAI 'Authentication' documentation.

Things to check before using it for work

Even if you have a personal Plus or Pro subscription, this does not mean you are permitted to input company source code or documents. Before using it for work, please check the following items:

  • Use of Codex is permitted under your company's generative AI usage policy and information security rules

  • You have obtained approval from your supervisor, the person in charge, or the workspace administrator

  • You have selected the account and workspace designated by your company

  • You have confirmed the scope of source code, logs, and design documents that are permitted to be input

  • Do not input personal information, customer information, company confidential information, unpublished information, or contract information

  • Do not input passwords, API keys, access tokens, AWS access keys, secret keys, or the contents of .env files

  • Use permitted practice or development folders, not production environments, shared folders, or synchronized folders

  • Keep a change history using Git and back up important files in advance

On company PCs, administrator privileges and software installation may be restricted. If you cannot execute it, do not attempt to bypass the restrictions; instead, check with your internal administrator. Even if you are using ChatGPT Business, the features available may differ depending on the workspace administrator's settings and internal company rules.

5. Overall flow until using Codex

Install WSL and Ubuntu

  1. Perform initial setup for Ubuntu

  2. Update Ubuntu

  3. Install nvm

  4. Install Node.js and npm

  5. Install the Codex CLI

  6. Create a practice folder

  7. Launch Codex and log in

  8. Enter your first prompt

From here, I will explain each step in detail. Since the commands to run differ between PowerShell and Ubuntu, please check the "Execution Location" immediately before each code block.

6. Step 1: Install WSL and Ubuntu

WSL is a mechanism that allows you to use Linux within Windows. Ubuntu is a type of Linux. In this step, we will enable WSL on Windows and install Ubuntu.

Screen to use: Search for "PowerShell" in the Windows Start menu and select "Run as administrator".

Administrator privileges: Required during installation. If a confirmation screen appears, check the content and select "Yes".

Execution location: Windows PowerShell (Administrator)

wsl --install -d Ubuntu

This command enables the features required for WSL on Windows and installs Ubuntu. WSL 2 is typically used for new installations. The download may take some time. If you are prompted to restart, save any files you are working on and restart your PC. You can check the latest requirements for the command at the official Microsoft page "How to install Linux on Windows with WSL".

If only the help menu is displayed in an environment where WSL is already installed, check the available Linux distributions.

Execution location: Windows PowerShell (Administrator)

wsl --list --online

If Ubuntu is in the list, run the following again.

Execution location: Windows PowerShell (Administrator)

wsl --install -d Ubuntu

Once the installation and restart are complete, launch PowerShell normally and check the status.

Execution location: Windows PowerShell

wsl -l -v

Normal state: Ubuntu is displayed in the NAME column, and 2 is displayed in the VERSION column. Even if the STATE is Stopped, it is not an error; it just means Ubuntu is not currently open.

Only if the VERSION is 1, convert Ubuntu to WSL 2 using the following command.

Execution location: Windows PowerShell (Administrator)

wsl --set-version Ubuntu 2

If an error occurs requesting an update to the WSL kernel, execute the following.

Execution location: Windows PowerShell (Administrator)

wsl --update

The usage of wsl -l -v, wsl --set-version, and wsl --update can also be confirmed in the official Microsoft 'Basic commands for WSL' documentation.

Check points in case of error: Check if Windows Update has been applied, if you have restarted your PC, and if you opened PowerShell as an administrator. If you are blocked on a company PC, please consult your administrator.

Condition to proceed to the next step: Ubuntu is displayed with wsl -l -v and the VERSION is 2.

7. Step 2: Launching Ubuntu for the first time

In this step, you will launch the installed Ubuntu for the first time and set up user information for Linux.

Screen to execute: Search for "Ubuntu" in the Windows Start menu and select Ubuntu.

Administrator privileges: Usually not required.

The first launch will take some time for preparation, and you will be asked to enter a Linux username and password. We recommend using half-width alphanumeric characters for the username. You can set a different username and password than your Windows credentials.

While entering the password, neither characters nor "" will be displayed on the screen. Even if nothing is displayed, the input is being processed. Press the Enter key after typing. This password will be used later when executing the sudo command.

After setting the username and password, execute the following two lines one by one from the top to verify the initial settings.

Execution location: Ubuntu/WSL

whoami
pwd

whoami displays the current Linux username, and pwd displays the current folder.

Normal state:whoami displays the username you set, and pwd displays a location like /home/username. After that, it returns to an input prompt like username@PCname:~$. The symbol at the end is a screen display, so do not include it in commands you copy in the future.

Check points in case of error: If the screen closes, restart your PC and check wsl -l -v in PowerShell. If Ubuntu is not displayed, return to Step 1.

Condition to proceed to the next step: You can execute whoami and pwd, and you remember the password you set.

8. Step 3: Update Ubuntu

In this step, you will update Ubuntu's software information and installed software, and install curl and Git. curl is a tool for retrieving data from the internet, and Git is a tool for managing file change history.

Screen to use: The Ubuntu terminal. The terminal is a screen where you type text to issue commands to the computer.

Administrator privileges:Required for the three commands that use sudo.

Please execute the following two lines one by one from the top.

Execution location: Ubuntu/WSL

sudo apt update
sudo apt upgrade -y

sudo apt update retrieves the latest information on installable software. sudo apt upgrade -y updates installed software. sudo specifies execution with administrator privileges, and -y specifies automatically answering 'Yes' to confirmation prompts.

You may be asked for your Ubuntu password when running sudo. Nothing will be displayed while you type, but just type it and press the Enter key.

Next, install the basic tools.

Execution location: Ubuntu/WSL

sudo apt install -y curl git

After installation, execute the following two lines one by one from the top.

Execution location: Ubuntu/WSL

curl --version
git --version

Normal state: Version numbers are displayed for both curl and git.

Checkpoints for errors: Check your internet connection, your Ubuntu password, and whether the initial sudo apt update finished without errors. If your company requires proxy settings, please check with your administrator.

Condition to proceed:Both curl --version and git --version display their versions.

9. Step 4: Install nvm

nvm is a tool for managing Node.js versions. It makes it easier to change or update Node.js compared to installing it directly. Install it on the Ubuntu/WSL side, not the Windows side.

Screen to use: The Ubuntu terminal.

Administrator privileges: Not required. Do not use sudo.

As of August 2, 2026, the latest version provided by the official nvm GitHub repository is v0.40.6. Execute the following.

Execution location: Ubuntu/WSL

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.6/install.sh | bash

This command retrieves the official installation script via curl and executes it with bash. Next, it loads the added settings into the current terminal.

Execution location: Ubuntu/WSL

source ~/.bashrc

Execute the following two lines one by one from the top to verify the installation.

Execution location: Ubuntu/WSL

command -v nvm
nvm --version

Normal state:Running command -v nvm displays nvm, and nvm --version displays the version number. We do not use which nvm because nvm is not a standard executable file, but a function loaded into the shell.

Checkpoints for errors: If nvm is not found, check in the following order.

  1. Run source ~/.bashrc again

  2. Close and restart Ubuntu

  3. Run command -v nvm again

  4. Check if any errors were displayed during installation

Condition to proceed:command -v nvm displays nvm.

10. Step 5: Install Node.js and npm

Node.js is an execution environment for running JavaScript on your computer. npm is a mechanism for installing software for Node.js. LTS stands for Long Term Support, which is a stable and easy-to-use version of Node.js. You can check the current LTS on the official Node.js download page, and the support status for each version on the official Node.js release information page.

Screen to execute on: Ubuntu terminal.

Administrator privileges: Not required. Since we are using nvm, do not use sudo.

Please execute the following three lines one by one from the top.

Execution location: Ubuntu/WSL

nvm install --lts
nvm use --lts
nvm alias default 'lts/'

nvm install --lts installs the latest LTS version of Node.js. nvm use --lts uses the LTS version in the current terminal. nvm alias default 'lts/' sets the LTS version as the default for future sessions.

Execute the following two lines one by one from the top.

Execution location: Ubuntu/WSL

node -v
npm -v

Normal state:Running node -v displays a number starting with "v", and npm -v displays a numeric version number. If there are no errors, you are ready to proceed.

Check points for errors:Check if nvm is loaded by running command -v nvm, and execute source ~/.bashrc if necessary. If the download fails, check your internet connection.

Conditions to proceed:Both node -v and npm -v must display their versions.

11. Step 6: Install the Codex CLI

In this step, you will install the official OpenAI npm package @openai/codex. You can verify the package name and npm command in the official OpenAI Codex repository. To keep the steps consistent with the images in this article, we will primarily use the method involving Node.js and npm.

Screen to execute in: Ubuntu terminal.

Administrator privileges: Not required. Since you are using nvm, do not use sudo.

Execution location: Ubuntu/WSL

npm i -g @openai/codex

npm i is a shorthand for npm install. The -g flag is specified to allow the codex command to be used from any folder within the Ubuntu environment. The basic procedure does not use sudo npm i -g @openai/codex.

Execute the following two lines one by one from the top.

Execution location: Ubuntu/WSL

codex --version
command -v codex

Normal state:codex --version displays the Codex CLI version, and command -v codex displays the installation path.

Check points for errors:If codex: command not found is displayed, execute the following four lines one by one from the top.

Execution location: Ubuntu/WSL

source ~/.bashrc
npm list -g --depth=0
npm prefix -g
echo $PATH

source ~/.bashrc reloads the settings. npm list -g --depth=0 checks if @openai/codex is in the list. npm prefix -g displays the global npm installation path, and echo $PATH displays the list of locations where commands are searched. Check if the execution location corresponding to the npm installation path is included in the PATH.

Conditions to proceed:codex --version must display the version.

12. Supplementary: How to use the official standalone installer

The official OpenAI "Codex CLI" also provides information on standalone installers for macOS and Linux. This is an alternative method that does not use Node.js or npm.

Execution location: Ubuntu/WSL

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

After installation, verify it as follows.

Execution location: Ubuntu/WSL

codex --version

13. Step 7: Create a practice folder

Do not try this in a business project or production environment from the start; create a practice folder within the Ubuntu home directory. A directory is a folder where files are stored together.

Screen to execute in: Ubuntu terminal.

Administrator privileges: Not required.

Please execute the following four lines one by one from the top.

Execution location: Ubuntu/WSL

mkdir -p ~/projects/codex-practice
cd ~/projects/codex-practice
pwd
ls -la

mkdir -p creates a folder. cd moves to the working folder. pwd shows the current location, and ls -la displays the files in the folder.

Initialize as a Git repository. A repository is a place where programs and related files are collected and change history is managed.

Execution location: Ubuntu/WSL

git init

Create a practice README.

Execution location: Ubuntu/WSL

printf "# Codex練習用プロジェクト\n" > README.md

Execute the following three lines one by one from the top to verify.

Execution location: Ubuntu/WSL

ls -la
cat README.md
git status

cat README.md displays the file content, and git status displays the change status managed by Git.

Normal state: README.md is in the list, cat README.md displays "# Codex Practice Project", and git status displays the Git repository status.

Checkpoints for errors:Check if you are under the home directory with pwd and if you executed the commands one line at a time. If "Permission denied" appears, do not use sudo; return to the home directory with cd ~ and try again.

Condition to proceed: README.md exists and git status works without errors.

14. Step 8: Launching and Logging into Codex

Codex may check or modify files in the folder where it is launched. Therefore, always check your current folder before starting.

Screen to use: Ubuntu terminal.

Administrator privileges: Not required.

Please execute the following three lines one by one from the top.

Execution location: Ubuntu/WSL

cd ~/projects/codex-practice
pwd
codex

Use cd to move to the practice folder, check your location with pwd, and then launch the Codex CLI with codex.

Upon the first launch, authenticate using the following process.

  1. Run the codex command

  2. Check the first-launch instructions

  3. Select the displayed ChatGPT authentication method, such as "Sign in with ChatGPT"

  4. A browser will open

  5. Sign in with your ChatGPT account

  6. Authorize the authentication

  7. Return to the Ubuntu terminal

  8. Confirm that the Codex input screen is displayed

If you want to explicitly start only the authentication process, you can also use the following official command on the Ubuntu screen where Codex is closed.

Execution location: Ubuntu/WSL

codex login

You can check your login status with the following.

Execution location: Ubuntu/WSL

codex login status

When using ChatGPT Business, use your company-designated account and ensure you do not mistake it for a personal account. Please prioritize your company's information security rules. Available features may vary depending on the settings configured by your workspace administrator.

For browser authentication, codex login, and checking your login status, please refer to OpenAI's official "Authentication" documentation.

First, check your Codex permissions

After logging in, check your permissions before requesting any tasks. Please enter the following in the Codex input field.

Execution location: Codex CLI input field

/permissions

When the permission selection screen appears, start by choosing a read-only mode or a mode that requests approval before executing commands or modifying files. Depending on the version, the names on the screen may appear as "Read Only," "Ask for approval," etc. In read-only mode, you can try checking files and getting explanations. You can check the differences between each mode in OpenAI's official "Permission modes" documentation.

For information on sandboxes, approval policies, and dangerous full-access settings, please also refer to OpenAI's official "Security" documentation and OpenAI's official "Agent approvals & security" documentation.

When an approval screen appears, check the command to be executed, the target file, and the target folder one by one. If you do not understand the content, if an unexpected location is displayed, or if the action involves deletion, overwriting, or external transmission, do not approve it; stop the work and ask for a detailed explanation.

Normal state: After authentication is complete, the Codex input field will appear on the Ubuntu side, and you will be able to enter Japanese.

Troubleshooting errors: If the browser does not open automatically, check the URL or instructions displayed in the terminal. Also, check your internet connection, the account being used, company browser authentication restrictions, and workspace Codex usage settings.

Condition to proceed: The Codex input screen is displayed in the practice folder.

15. Step 9: Enter your first instruction to Codex

Start by trying a confirmation instruction that does not modify any files. The text for this step should be entered into the launched Codex input field, not as a standard Ubuntu command.

Screen to execute on: The Codex CLI input screen.

Administrator privileges: Not required.

Execution location: Codex CLI input field

このフォルダの構成を確認してください。
まだファイルは変更せず、それぞれのファイルの役割を初心者向けに説明してください。

You can paste and execute the two lines above together. Confirm that Codex checks files like README.md and returns only an explanation.

Next, request only improvement suggestions.

Execution location: Codex CLI input field

README.mdの改善案を提示してください。
まだファイルは変更せず、変更予定の内容を先に説明してください。

Read the proposal, and if there are no issues, authorize the changes.

Execution location: Codex CLI input field

先ほどの提案内容でREADME.mdを更新してください。
更新後に、変更した箇所と変更理由を初心者向けに説明してください。

To increase safety, you can also add the following conditions to your instructions:

  • Please explain the command to be executed first

  • Do not execute the command yet

  • Please list the files that will be changed

  • Please confirm before changing any files

  • Do not delete any important files

  • Please explain the git diff content after the changes

Normal state: In the initial instruction, no files are changed and an explanation is returned; README.md is only updated after the instruction authorizing the changes.

Checkpoints for errors: If the response is different from your goal, stop the work, tell it 'do not change anything yet,' and clarify the goal and completion conditions. Do not continue to approve without checking what Codex has proposed.

Conditions for proceeding: Understanding the instruction not to change files and the workflow of having proposals made before changes.

16. Exiting Codex

To exit the Codex CLI normally, execute either of the following in the input field:

Execution location: Codex CLI input field

/quit

Alternatively, you can use the following:

Execution location: Codex CLI input field

/exit

Both /quit and /exit are exit commands listed in the official OpenAI 'Codex CLI command reference'. If you need to interrupt a running process, you can use Ctrl+C, but this is a keyboard operation to interrupt processing. It should not be used every time instead of a normal exit. Please check the processing status before exiting.

After exiting Codex, execute the following to close the Ubuntu/WSL terminal itself.

Execution environment: Ubuntu/WSL

exit

17. Environment Setup Checklist

  • Confirmed the ChatGPT plan and usage limits to be used

  • Selected the company-designated account and workspace for business use

  • WSL 2 and Ubuntu are installed

  • Can launch Ubuntu

  • Successfully set the Ubuntu username and password

  • Successfully executed sudo apt update

  • Version is displayed with curl --version

  • Version is displayed with git --version

  • nvm is displayed with command -v nvm

  • Version is displayed with node -v

  • Version is displayed with npm -v

  • Version is displayed with codex --version

  • Successfully created a practice folder

  • Successfully launched Codex

  • Successfully authenticated with a ChatGPT account

  • Checked permissions with /permissions and selected read-only or approval-required settings

  • Understood not to input confidential information or directly operate on production environments

  • Successfully executed a confirmation instruction that does not modify files

18. Tips for giving instructions to Codex

Bad example

Execution location: Codex CLI input field

いい感じに直してください。

Because the purpose, target, and completion criteria are unknown, this instruction is likely to result in changes that differ from your intent.

Good example

Execution location: Codex CLI input field

このプロジェクトのエラー原因を調査してください。
まだファイルは変更せず、原因と修正方針だけを初心者向けに説明してください。

Good instructions include the purpose, target file, what you want done, what you do not want done, completion criteria, whether confirmation before changes is required, the level of detail for explanations, and whether confirmation before command execution is required.

19. Pros and cons of Codex

Pros
  • Can streamline code creation and modification

  • Can ask questions about things you do not understand

  • Can get help understanding existing code

  • Can create READMEs and procedure manuals

  • Makes it easier to turn ideas into reality

  • Can reduce repetitive tasks

  • Can create development drafts in a short time

  • Can get help with creating test code

Cons and points of caution
  • Codex can also make mistakes

  • May suggest commands or settings that do not exist

  • May modify or delete unintended files

  • May generate code containing security issues

  • Humans must verify execution results and changes

  • Do not input confidential information, customer data, personal information, or passwords

  • Do not input API keys, access tokens, AWS access keys, or secret keys

  • Do not paste the contents of .env files

  • Do not modify production environments directly

  • Keep a record of changes using Git or similar tools

  • Back up data before performing important tasks

  • Start by trying small tasks first

The danger of granting excessive permissions

The convenience and danger of Codex change depending on the level of permissions granted. Even within a normal working folder, if editing is permitted, files can be overwritten or deleted. With full access that disables approvals and the sandbox, the scope of potential damage expands further. A sandbox is a safety mechanism that limits the range of operations.

  • You may lose necessary files due to incorrect deletion commands like 'rm'

  • Development environments or applications may stop working due to overwriting, moving, or configuration changes

  • Since WSL can access Windows files via paths like '/mnt/c', files on the Windows side may be affected depending on the startup location and permission scope

  • If broad network access is permitted, input content or files may be sent to unintended external services

  • The AI may be influenced by instructions contained in untrusted repositories, web pages, or documents, leading it to suggest or execute unintended processes

  • If you grant permission continuously without checking the approval screen, safety features will effectively cease to function

Do not use '--dangerously-bypass-approvals-and-sandbox' or '--yolo'. Only permit necessary tasks, limit the target folder, and check 'git status' and 'git diff' before and after changes.

Essential rules for professional use
  • Prioritize internal generative AI usage policies, information security rules, and customer contracts above all else.

  • Use only accounts, workspaces, PCs, and projects authorized by the company.

  • Do not input personal information, customer information, confidential company documents, unreleased product information, internal URLs, or account information.

  • Do not input passwords, API keys, access tokens, AWS access keys, private keys, cookies, or the contents of .env files.

  • Do not launch Codex while connected to production servers or production data.

  • Follow company approval procedures for operations involving deletion, external transmission, package addition, permission changes, or deployment.

  • Do not rely solely on Codex's explanations; have a human verify official documentation, test results, and code diffs.

  • If you suspect a data leak or system damage, stop processing immediately. Do not attempt to hide it or fix it on your own; contact the administrator.

20. Recommended usage order for beginners

  1. Request an explanation of the folder structure.

  2. Request an explanation of the code.

  3. Request the creation of a README.

  4. Request the creation of small files.

  5. Request an investigation into errors.

  6. Ask for suggested fixes.

  7. Have a human verify the content.

  8. Have small fixes implemented.

  9. Have test code created.

  10. Request small-scale automation.

21. Common Errors

Cannot execute wsl command

Check if you have opened PowerShell as an administrator, if your Windows version is supported, and if Windows Update has been applied. If features are restricted on a company PC, please consult your administrator.

Ubuntu does not start

Check if you have restarted your PC, then execute the following in PowerShell, one line at a time from the top.

Execution location: Windows PowerShell (Administrator)

wsl -l -v
wsl --update

Check if Ubuntu is in the list and if it can be started after the WSL update.

Cannot seem to enter the sudo password

In Ubuntu, characters or asterisks () are not displayed while entering a password. Even if nothing appears, the input is being registered, so type your password and press the Enter key.

nvm: command not found

Execution location: Ubuntu/WSL

source ~/.bashrc
command -v nvm

Execute one line at a time from the top. If it still does not appear, close the Ubuntu window and restart it from the Start menu.

node: command not found

Execution location: Ubuntu/WSL

nvm use --lts
node -v

Execute one line at a time from the top, and check after setting it to use the LTS version.

npm: command not found

Check if the Node.js installation is complete by executing the following three lines one at a time from the top.

Execution location: Ubuntu/WSL

nvm install --lts
nvm use --lts
npm -v
codex: command not found

Execute the following five lines one at a time from the top.

Execution environment: Ubuntu/WSL

npm list -g --depth=0
npm prefix -g
echo $PATH
source ~/.bashrc
codex --version

Check if @openai/codex is in the list and if the npm installation directory is accessible via your PATH.

Browser authentication does not proceed
  • Can you connect to the internet?

  • Are you logged into the correct ChatGPT account?

  • Is browser authentication restricted by your company's security settings?

  • Have you checked the URL and instructions displayed in the terminal?

  • Has Codex been restricted by your workspace administrator?

If standard browser-based authentication is difficult and permitted by your administrator, you may be able to use the official device code authentication.

Execution environment: Ubuntu/WSL

codex login --device-auth

Authenticate using the displayed URL and temporary code. If using a company PC, please check with your administrator before proceeding.

22. Summary

Codex is an AI that assists with development, not a replacement for developers. Even IT beginners can provide instructions in Japanese. On Windows, you can build an environment to use the Codex CLI by using WSL and Ubuntu and executing the commands in this article in order.

Always have a human verify the content generated by Codex. Start with a small, safe practice folder. Having a human make the decisions and letting the AI assist with the work is the safe and effective way to use it.

同じカテゴリの記事

東條 淳平

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

おすすめの関連記事