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
Steps to check Codex CLI version:
- Run the version check from the terminal that will start Codex.
$ 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.
- Use the short version flag when a command example or script expects the compact form.
$ codex -V codex-cli 0.139.0
codex -V and codex --version print the release string for the active binary.
- Confirm the flag exists in local help when a wrapper, alias, or old binary behaves unexpectedly.
$ codex --help Codex CLI ##### snipped ##### -V, --version Print version - Treat a shell error as an install or PATH problem for that environment.
$ 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 - Re-run the version check after an install, upgrade, or shell change.
$ 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
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.