Update prompt fails because it does not include `sudo`.

Open 💬 2 comments Opened Mar 2, 2026 by JaredTweed

What version of Codex CLI is running?

codex-cli 0.104.0

What subscription do you have?

Plus

Which model were you using?

N/A

What platform is your computer?

Linux 6.18.13-100.fc42.x86_64 x86_64 unknown (Fedora 42 Workstation)

What terminal emulator and version are you using (if applicable)?

_No response_

What issue are you seeing?

When codex prompts for an update, it doesn't have sudo in the prompted update. Thus causing it to fail and for me to type sudo npm install -g @openai/codex.

<img width="579" height="203" alt="Image" src="https://github.com/user-attachments/assets/5f65cce9-edfa-4717-a6f8-a99c9b7966a8" />

<img width="1364" height="637" alt="Image" src="https://github.com/user-attachments/assets/5a6d2c68-42be-4f1b-b332-3b1b81582e55" />

What steps can reproduce the bug?

Use Linux, have codex-cli prompt for an update, and select "Update now".

What is the expected behavior?

The expected behavior is for it to update correctly (using sudo) when selecting "Update now" when prompted.

Additional information

_No response_

View original on GitHub ↗

2 Comments

dchauran · 2 months ago

Would love to see this addressed. I had to disable the update check because it's super annoying to have to start codex, see there is an update, exit codex, update codex then start codex nearly every day.

trstoyan · 2 months ago

Hi @JaredTweed, I hit the same class of issue on Linux. I do not think the updater should blindly add sudo to the npm command, though.

sudo npm install -g @openai/codex can fix the immediate update, but it often leaves root-owned npm files behind and causes more permission problems on later updates. npm's own EACCES
guidance recommends either using a Node version manager or changing the global npm prefix to a user-owned directory.

Two workarounds that avoid sudo:

```bash
mkdir -p ~/.local
npm config set prefix ~/.local
echo 'export PATH=~/.local/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
npm install -g @openai/codex@latest

Or with nvm:

nvm install node
nvm use node
npm install -g @openai/codex@latest

One caveat: do not mix nvm with a custom npm prefix in ~/.npmrc; nvm warns that those settings are incompatible.

So the CLI issue may be less “missing sudo” and more that the updater should detect an EACCES/global-prefix situation and show safer guidance instead of retrying a command that cannot write
to root-owned npm directories.