Add `codex upgrade` command for self-updates

Resolved 💬 11 comments Opened Jan 15, 2026 by rafaell-lycan Closed Apr 28, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What feature would you like to see?

Introducing a built-in codex upgrade command to automatically detect the installation method (npm/homebrew) and update Codex CLI to the latest version.

This eliminates the need for users to remember or manually check their install method, similar to OpenCode's streamlined approach.

Additional information

Feature already exists in:

  • OpenCode CLI: opencode upgrade
  • Claude Code: claude update

View original on GitHub ↗

11 Comments

itstrivial · 6 months ago

I’d like to take this one. Could you please assign it to me?

etraut-openai contributor · 6 months ago

Codex CLI already automatically detects when a new version is available and offers to install it for you. I don't know that a separate command is needed here.

I'll leave this feature request open and see if it gathers enough upvotes for us to consider it.

itstrivial · 6 months ago

If a separate codex update command (update appears more consistent to me with the rest of the codebase than upgrade) is implemented one day, here are a couple of leads. I only reviewed the codebase very briefly, so please use this at your own risk and consider whether there're better options.

Potential Implementation

There's a pub(crate) fn get_update_action() -> Option<UpdateAction> function in tui/src/update_action.rs that determines how Codex CLI was installed by checking the environment variables. It can be exposed to add something similar to codex-rs/cli/src/main.rs:

Some(Subcommand::Update) => {
            #[cfg(not(debug_assertions))]
            {
                match get_update_action() {
                    Some(action) => {
                        run_update_action(action)?;
                    }
                    None => {
                        eprintln!(
                            "Could not detect installation method. Please update manually: https://developers.openai.com/codex/cli/"
                        );
                        std::process::exit(1);
                    }
                }
            }
            #[cfg(debug_assertions)]
            {
                eprintln!(
                    "The update command is not available in debug builds. Build with --release or install to use this command."
                );
                std::process::exit(1);
            }
        }

Good luck!

not-an-llm · 5 months ago

It's a small thing, but it is not a great experience to run codex update only to realize this kicks off a convo with a silly one-word prompt "update".

<img width="740" height="538" alt="Image" src="https://github.com/user-attachments/assets/65881832-a751-409e-af94-d3aa5fd92e28" />

Then I have to kill it and exit and type the command that's right there then restart.

Other coding agents support a update|upgrade subcommand. codex does stick out here.

0xdeafbeef · 5 months ago

Would be nice to have something like rustup or tiup. So user can do oai install codex / codex-ui without npm or relying on a system package manager to keep up with the release cadence.
Or simple install.sh like in zed with auto-updates driven by codex

m3ac-AllbrittenJ · 4 months ago

commenting to show support/desire for this. I hate node ecosystem and package management. I try to avoid it wherever possible. used the recently introduced install.sh introduced today, but wish for native update command like copilot cli, claude code, and opencode

codex cli is the only standout here that does not support this

nvictor · 4 months ago

Let's call it update please 😊

I think it's needed because self-detect and auto-install usually runs into permission issues typically when sandboxing the tool.

DysektAI · 2 months ago

+1 For this, what is the reason we have to run codex to see: "A new version is available run this to install it now: npm install -g @openai/codex" which requires:

  1. Copying the command
  2. Exiting codex cli
  3. Pasting + running
  4. Just to rerun codex again after

A command like codex update / codex upgrade would make this take 2-3 steps max while being more streamlined. Ideally I would just appreciate on launch displaying options like Update or Continue before initializing fully... This would make it much less of a chore/process and improve UX especially with the rate of how often updates are released.

Just seeing the update notice has sidetrack me into updating leading to killing momentum and forgetting why I needed/opened codex in the first place.

I addressed this by replacing the codex alias for my system to work like this for now:

  1. Check for updates - New version? = Step 2 | Already Latest? = Skip to Step 3.
  2. Runs the relevant update command - Waits for it to complete successfully.

(Some safeguards setup for potential issues like automatic fallback on failure.)

  1. Runs codex like normal - just never outdated.
tonydehnke · 2 months ago

Adding support for this.. also less muscle memory for other users coming from other platforms that are used to running "xyz update/upgrade" - so it's a smoother experience.

I don't see any reason not to implement it. In fact not doing so and making people do multiple steps to run: npm install -g @openai/codex feels more like a geeks only gatekeeper mode than anything else.

etraut-openai contributor · 2 months ago

I've added codex update. This will be included in the next release.

killtux · 2 months ago

is it possible when die "update available" menu is display to update with -su instead since most time its run with normal user privileges and update wont be possible without quitting codex and starting it with sudo? (and also get the first-time login screen, quit again, start again and then it updates).