A terminal can keep an older codex binary on PATH after an install, upgrade, or shell change. Checking the version from the same shell that will start Codex shows which Codex CLI release will answer the next command before troubleshooting behavior or comparing machines.
The codex --version command prints a single codex-cli x.y.z line and exits without requiring a login. The shorter codex -V flag is the same version option, and codex --help lists -V, --version in local help output.
Use the returned value as a shell-specific fact rather than a machine-wide guarantee. A different terminal tab, automation account, or package-manager prefix can resolve another codex binary, so rerun the check wherever the later Codex command will run.
Related: How to install Codex CLI with Homebrew
Related: How to upgrade Codex CLI with Homebrew
Related: How to check Codex login status
$ codex --version codex-cli 0.139.0
The numeric value changes as new Codex CLI releases ship. Use the string printed by your shell when comparing hosts, reporting a problem, or confirming an upgrade.
$ codex -V codex-cli 0.139.0
codex -V and codex --version print the release string for the active binary.
$ codex --help
Codex CLI
##### snipped #####
-V, --version
Print version
$ codex --version zsh: command not found: codex
The shell did not find codex, so it cannot report a version. Install Codex CLI or open a shell that loads the package-manager prefix before retrying.
Related: How to install Codex CLI with Homebrew
$ codex --version codex-cli 0.139.0
If the value is still not the release expected after a Homebrew upgrade, reopen the shell and confirm the Homebrew prefix is earlier on PATH.
Related: How to upgrade Codex CLI with Homebrew