ホーム 暮らし How to install Codex CLI on Mac (For absolute beginners)

How to install Codex CLI on Mac (For absolute beginners)

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

I will explain how to install Codex CLI on a Mac in a simple way.

Since Codex CLI is a paid service, this is written for those who have a ChatGPT subscription.

This article is intended for Mac users.

▼ If you are using Windows, please see the article below.



Check if the necessary tools are installed

n01ea69f970bc

First, click the magnifying glass button in the top right corner.

Type "Terminal".

Press Enter to open it.

The screen that appears is called "Terminal".
Mine is a white screen, but it is often displayed as a black screen.

Copy and paste the following command into the Terminal.

node --version

If something like v24.4.1 or v22 appears, you are good to go!
If it did not appear, please continue reading below.

And here is a fork in the road. Please check the following with me.


✖ If the v-something did not appear, or if an old version like v21 or lower was displayed

You have not installed the necessary tools yet, so please continue reading as is.
It will not work with versions older than v22, so you must have a newer version of v22 or higher installed.


〇 If v22, v24, or a number higher than v22 was displayed

You have already finished installing the necessary tool (the first one).
Therefore, you can skip the following and continue reading from the "Installing Codex CLI" heading.



Install the necessary tools

If the 'v...' version did not appear above, or if an old version like v21 or lower was displayed, let's install the necessary tools here.

Type 'Terminal'.

Press Enter to open it.

Copy and paste the following command into the Terminal.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Next, enter the password you use to log in to your Mac.
Nothing will appear on the screen when you type, but that is how it is designed. Even though you cannot see it, it is being entered correctly, so please press the Enter key after typing your password.


This installation takes a long time. It will take 5 to 10 minutes.

Please just watch and do nothing.
If the screen does not progress after 10 minutes, press the Enter key once. It may proceed.

Once you reach this screen, you are done.

The last line should look like
'something@something ~ %' and you are good to go!

Next, copy and paste the following to install the necessary tools.

brew install node

Copy and paste the command below to verify that it was installed.

node --version

If it shows something like v24.4.1 or v22..., you are all set!





Installing Codex CLI


Next, please copy and paste the following into your terminal and press the Enter key.
We will now proceed with installing the Codex CLI.

npm install -g @openai/codex

Once installed, copy and paste the following and press the Enter key.

codex

You will then see options like the ones below.
Please just press the Enter key.
(This will select Sign in with ChatGPT)

You will then be prompted to log in to ChatGPT, so please go ahead and log in.

Sometimes you may see a state like the one below.
A brief explanation is displayed, but there is no need to read it, so please press the Enter key to proceed.

Next, you will see a state like the image below.
Either option is fine, but if you prioritize safety, choose 2.

(1 allows the Codex CLI to run freely without human approval.
2 allows you to set it so that the Codex CLI asks for human approval before running.)

Finally, once you reach the state shown in the image below, you are ready.

Congratulations!
It has been installed!\(
ˊᗜˋ)/

Oh, please do not start development here.
Please close the terminal once.


If you were able to install it,
skip the "For those who could not install" section below, and
proceed to "Let's start development!"




For those who could not install it


The reasons why you could not install itvary from person to person... Since I cannot explain everything, please try searching online.

Possible causes include not having the latest versions of the required tools installed.

Please follow the article below and adjust the installation for Mac.





Let's start developing!

The installation is now complete!
However, to start developing,
let's create a folder for your development work! (Required)

If you don't create a folder and organize things properly,
your computer will become a mess.


Steps

1. Decide what you want to build (it's okay if you don't have an idea yet)
2. Create a folder
3. Open that folder in the terminal
4. Proceed with development using Codex CLI


Let's go through them in order!

1. Decide what you want to build (it's okay if you don't have an idea yet)

If this is your first time, let's make a timer!
Simple projects are recommended.


2. Create a folder

You can create a folder anywhere you like on your PC, but I'll introduce a recommended location.
If you don't have a preference, you can just follow these steps.
First, control-click on Finder in the bottom left.

Click on "Users".

Look at the window that appears, and
click the folder that has a house icon on it.

Control-click and then click "New Folder".

Use Roman characters for the folder name. Do not enter any spaces.
Let's use this folder to proceed with development.
Please click on the folder.

The folder should be empty.

Next, hold down the Control key and click, then click New Folder.
Give it the name of the project you plan to develop.
Use Roman characters. Do not enter any spaces.

As for the folder name, since I plan to make a timer, I named it timer.


3. Open that folder in Terminal

Next, hold down the Control key and click the folder you just created for your development, then click "New Terminal at Folder".

The terminal will open.

Type codex and press Enter to launch the Codex CLI.

codex

Important check: Look at the red underlined part in the image below.
You can see which folder the Codex CLI is currently in.

Make it a habit to always check that it matches the name of the folder you want to open!

If you get the folder location wrong, you might end up developing in the wrong place and your files will get all messed up...



Pro tip: How to never forget how to open your development folder location

When I first started, I used to get so frustrated, thinking, "Where on earth is my folder!?"

To make sure no one else suffers the same fate, I will share a way to never forget where your folder is located.


First, hold down the Control key and click on Finder in the bottom left.

Click on Users.

The folder where you stored the folder you just created, hold down the Control key and click it.
Click "Make Alias".

Drag and drop the created alias folder onto your desktop.

Now you can open the folder from your desktop at any time.

Alternatively, even if you don't want to open it from the desktop,
you can place it to the left of the Trash and access it whenever you like.

The folder from earlier can be dragged and dropped to the left of the Trash.

Now you can access the folder from the left of the Trash at any time!
Clicking it will look like the image below.

Click "Open in Finder" to open it.




4. Proceed with development using Codex CLI


Congratulations! \(ˊᗜˋ)/
You are now ready to start developing!

Let's start by developing something!

1. Create a timer (try customizing the design to your liking)
2. Create a site (your own official website)
3. Create a tool for yourself (a simple one for personal use!)

The above are recommended for beginners.


Installing VS Code

Furthermore, I will introduce a tool that will increase your development efficiency by more than three times.
Basically, it makes it easy for even beginners to do various things, so this VS Code tool is a must-install. Please go ahead and install it while you're at it.




For more detailed development methods, tips to accelerate your development by 10x, and secret prompts to make AI smarter, please check out the "Vibe Coding Bible" course!
▼Check the free section of the course page for more details▼




I am rooting for your vibe coding (^~^)!

Happy coding \(ˊᗜˋ*)/

同じカテゴリの記事

東條 淳平

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

おすすめの関連記事