How to Install Codex CLI: A Step-by-Step Guide

Must Read
bicycledays
bicycledayshttp://trendster.net
Please note: Most, if not all, of the articles published at this website were completed by Chat GPT (chat.openai.com) and/or copied and possibly remixed from other websites or Feedzy or WPeMatico or RSS Aggregrator or WP RSS Aggregrator. No copyright infringement is intended. If there are any copyright issues, please contact: bicycledays@yahoo.com.

When you’ve got already used Codex in ChatGPT, the Codex CLI will really feel acquainted. It brings the identical AI help immediately into your native growth surroundings, the place it could work along with your repository, shell, assessments, and different instruments.

Set up takes solely one command, however the setup selections that observe are price reviewing rigorously. On this article, you’ll discover ways to set up Codex CLI on Home windows, macOS, and Linux and full a clear first-time setup.

Earlier than You Set up

Use the standalone installer if you don’t already handle developer instruments by means of Homebrew or npm.

  • Home windows: PowerShell on a supported Home windows system. WSL2 is optionally available.
  • macOS or Linux: A terminal with curl out there.
  • Account: A ChatGPT account or an OpenAI Platform API key.
  • Workspace: A challenge folder you personal and belief.

Set up

1. Run the installer

Open a terminal. Subsequent, run the command in your working system.

macOS and Linux

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

Home windows PowerShell

powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/set up.ps1 | iex"

You can even run this through CMD. It executes the PowerShell command.

The Home windows installer provides Codex to your PATH; consequently, it’s prepared to be used. It additionally provides to launch the appliance.

Word: If the installer asks to begin Codex instantly, press N. Do that except the terminal is already inside a challenge folder.

Different set up strategies

Do you like a package deal supervisor? Use considered one of these choices as an alternative:

# Homebrew
brew set up --cask codex

# npm
npm set up -g @openai/codex

Equally, Homebrew is appropriate for a Brew-managed Mac setup. Use npm if Node.js already manages your world developer instruments.

First Run

2. Open a challenge folder

Transfer into the repository the place you need Codex to work. Then, launch it.

# Home windows PowerShell
cd C:Usersyoucodemy-project
codex

# macOS or Linux
cd ~/code/my-project
codex

Codex treats the present listing as its beginning workspace. By default the System32 listing could be the default one.

3. Select how you can register

The primary launch provides three sign-in routes:

  • Sign up with ChatGPT: Makes use of the Codex allowance out of your ChatGPT plan.
  • Sign up with Machine Code: Greatest for SSH, containers, or machines with out a browser callback.
  • Present your personal API key: Utilization is billed by means of the OpenAI Platform account linked to that key.
Codex CLI first-run menu with ChatGPT, device code, and API key authentication options.

OpenAI’s present Codex pricing web page lists Free, Go, Plus, Professional, Enterprise, Edu, and Enterprise plans. API-key utilization is billed individually. Then again, utilization in a subscription is shared between the net app and Codex.

4. Authorize Codex within the browser

If you happen to select ChatGPT, Codex prints an authentication URL. It additionally opens this URL in your browser. If the browser doesn’t open, copy and paste the URL your self.

PowerShell showing the Codex browser authentication handoff with the sensitive OAuth URL strongly blurred.
Codex prints the browser sign-in URL within the terminal.

Subsequent, register to the browser utilizing the ChatGPT account you need Codex to make use of.

ChatGPT sign-in screen opened by the Codex CLI browser authentication flow.

Examine the account on the affirmation display screen earlier than you proceed.

ChatGPT account confirmation screen with the user's email address strongly blurred.

Consequently, when the browser exhibits the success web page, shut the tab. Then, return to the terminal.

Browser page confirming that the user has signed in to Codex.

5. Assessment the first-run discover

Again within the terminal, Codex confirms your account. It additionally reminds you that autonomy is a alternative. Don’t ignore this discover. Press Enter after you learn it.

Codex command-line agent autonomy settings
Codex confirms the ChatGPT login and asks you to evaluation its autonomy settings

You may examine or change the lively boundary later. Use the /permissions command to do that.

6. Belief the best folder

Codex now prints the listing it’s about to belief. Learn the trail rigorously. Don’t simply take a look at the highlighted possibility.

Directory trust prompt for Codex
Don’t use System32 as default listing (this can be a VM for demonstration)

Belief permits project-local configuration, hooks, and execution insurance policies to load. If the trail is flawed, give up this system. Transfer into the proper repository and run codex once more.

7. Configure the Home windows sandbox

On native Home windows, Codex could ask how you can create its sandbox. Select the default sandbox if you happen to can approve the administrator immediate.

Codex sandbox configuration options
The default Home windows sandbox is the popular possibility

OpenAI’s Home windows sandbox documentation calls the elevated mode the popular native setup. It makes use of lower-privilege sandbox customers. It additionally makes use of filesystem boundaries, firewall guidelines, and native coverage modifications. The non-admin mode exists for machines the place elevation is unavailable. Nonetheless, it provides weaker safety.

8. Ship a protected first immediate

As soon as the immediate seems, begin with a read-only activity. This confirms that Codex can see the repository. It doesn’t ask the device to change something.

Clarify this repository's construction. Don't change any recordsdata. Then listing the three instructions I ought to run to confirm it regionally.
Codex ready for user input
The immediate seems after account, folder, and sandbox setup end

Helpful Instructions After Setup

  • /standing: present the mannequin, listing, account, and lively settings.
  • /permissions: examine or change what Codex can learn, edit, or run.
  • /mannequin: select the mannequin and reasoning effort out there to your account.
  • /init: create an AGENTS.md file for repository-specific directions.
  • /evaluation: evaluation modifications earlier than you commit them.
  • /exit: depart the CLI cleanly.

Hold the default workspace boundary except the duty wants extra entry. The permissions documentation explains the read-only, workspace, and full-access profiles.

Updating Codex CLI

For a standalone set up, rerun the platform installer. OpenAI makes use of the identical command for set up and updates.

# macOS or Linux
curl -fsSL https://chatgpt.com/codex/set up.sh | sh

# Home windows PowerShell
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/set up.ps1 | iex"

Replace package-manager installs by means of the identical supervisor:

# Homebrew
brew improve --cask codex

# npm
npm set up -g @openai/codex@newest

End with codex --version to substantiate the put in construct.

Conclusion

Putting in Codex CLI comes down to 3 strikes:

  1. An set up command
  2. Single account approval
  3. A workspace and sandbox determination

The one genuinely dangerous setup is the handy one within the flawed listing. Launch from the repository, maintain the sandbox boundary, examine /permissions, and start with a read-only instruction.

As soon as that’s clear, run /init and let the challenge carry its personal guidelines.

Learn extra: High 10 Expertise for Claude Code and Codex CLI

Q1. Is Codex CLI free?

A. The CLI is free to put in. Codex is included with ChatGPT Free, Go, Plus, Professional, Enterprise, Edu, and Enterprise plans, with totally different limits. API-key utilization is billed individually.

Q2. Do I would like Node.js?

A. No. The standalone installer doesn’t require Node.js. You want it provided that you select the npm set up technique.

Q3. Does Codex CLI want WSL on Home windows?

A. No. Codex runs natively on Home windows with a Home windows sandbox. WSL2 stays helpful when your repository and toolchain already stay in Linux.

This autumn. Can I take advantage of an API key as an alternative of ChatGPT?

A. Sure. Select ‘Present your personal API key’ throughout setup. That utilization follows OpenAI Platform billing, not your ChatGPT plan allowance.

Q5. How do I examine or take away the lively login?

A. Run codex login standing to examine it. Run codex logout to clear the cached credentials.

Vasu Deo Sankrityayan

Learning, evaluating, and explaining AI programs for over 6 years.

“𝘖𝘯𝘤𝘦 𝘮𝘦𝘯 𝘵𝘶𝘳𝘯𝘦𝘥 𝘵𝘩𝘦𝘪𝘳 𝘵𝘩𝘪𝘯𝘬𝘪𝘯𝘨 𝘰𝘷𝘦𝘳 𝘵𝘰 𝘮𝘢𝘤𝘩𝘪𝘯𝘦𝘴 𝘪𝘯 𝘵𝘩𝘦 𝘩𝘰𝘱𝘦 𝘵𝘩𝘢𝘵 𝘵𝘩𝘪𝘴 𝘸𝘰𝘶𝘭𝘥 𝘴𝘦𝘵 𝘵𝘩𝘦𝘮 𝘧𝘳𝘦𝘦. 𝘉𝘶𝘵 𝘵𝘩𝘢𝘵 𝘰𝘯𝘭𝘺 𝘱𝘦𝘳𝘮𝘪𝘵𝘵𝘦𝘥 𝘰𝘵𝘩𝘦𝘳 𝘮𝘦𝘯 𝘸𝘪𝘵𝘩 𝘮𝘢𝘤𝘩𝘪𝘯𝘦𝘴 𝘵𝘰 𝘦𝘯𝘴𝘭𝘢𝘷𝘦 𝘵𝘩𝘦𝘮.” — 𝖥𝗋𝖺𝗇𝗄 𝖧𝖾𝗋𝖻𝖾𝗋𝗍, 𝖣𝗎𝗇𝖾

Login to proceed studying and luxuriate in expert-curated content material.

Latest Articles

Frontier AI labs still won’t say how they’d contain a rogue...

Few of the highest AI labs have printed or demonstrated containment response plans, in keeping with a latest examine....

More Articles Like This