GuidesRunning & maintaining

How to uninstall Codex CLI (every install method)

Uninstall OpenAI's Codex CLI on macOS, Linux and Windows: npm, Homebrew, WinGet, the install script and release binaries, codex logout, and removing ~/.codex.

November 27, 2026The Everpod team
The short answer

Run codex logout first, then remove Codex the way it was installed. npm: npm uninstall -g @openai/codex. Homebrew: brew uninstall --cask codex. WinGet: winget uninstall --id OpenAI.Codex. The install script on macOS or Linux: rm ~/.local/bin/codex and rm -rf ~/.codex/packages/standalone, then delete the “Codex installer” block from your shell profile. On Windows, the PowerShell installer’s copy is in %USERPROFILE%\.codex\packages\standalone, linked from %LOCALAPPDATA%\Programs\OpenAI\Codex\bin. Your settings, sessions and (by default) your login file stay in ~/.codex until you delete it, which is optional and cannot be undone.

As of November 2026 (Codex 0.172.0), OpenAI’s docs and the openai/codex README give install commands for every route but no uninstall section. The steps below come from what each installer actually writes, read from the installers themselves.

Find out how it was installed

command -v codex          # the copy your shell runs
ls -l "$(command -v codex)"   # a symlink into ~/.codex/packages/standalone means the install script
npm -g ls @openai/codex   # npm global install
brew list --cask codex    # Homebrew cask
Copied

Read the path. ~/.local/bin/codex pointing into ~/.codex/packages/standalone/ is the install script. A path under /opt/homebrew or /usr/local on a Mac is usually Homebrew. A path under a Node prefix is npm, and one containing .bun is Bun; both are a small Node launcher (bin/codex.js) rather than the binary itself. Anything else is likely a binary you unpacked by hand from the GitHub releases. On Windows:

where.exe codex
(Get-Command codex).Source
winget list OpenAI.Codex
Copied

Two installs side by side are possible: the install script offers to remove an npm, Bun or Homebrew copy when it finds one, and if you said no, both are still there and PATH order decides which runs. Remove each by its own route.

Sign out first

Uninstalling the program does not sign you out, and on some setups the login is not in a file you would delete. Do this while codex still runs:

codex logout
Copied

It prints Successfully logged out, or Not logged in if there was nothing stored. Where the login lived depends on the cli_auth_credentials_store setting in config.toml, documented on OpenAI’s auth page:

ValueWhere the login is kept
file (the default in the 0.172 source)
auth.json under CODEX_HOME, so ~/.codex/auth.json
keyring
Your operating system’s credential store; fails if there is none
auto
The OS credential store when available, otherwise auth.json
ephemeral
Memory only, for the current process

With keyring, or auto where a credential store is available, deleting ~/.codex does not reach the stored login, which is why logging out comes first. For a ChatGPT sign-in, codex logout also asks OpenAI to revoke the token (the 0.172 source revokes the refresh token, or the access token if there is none), and it clears the local copy even if that request fails. For an API key login it only deletes the local copy: the key itself still works until you delete it in your OpenAI API dashboard. If you ran Codex with more than one CODEX_HOME, file storage keeps an auth.json in each, so run codex logout once per home, with CODEX_HOME set to that folder. The Codex login guide covers the sign-in methods and what each stores.

The IDE extension (VS Code, Cursor, Windsurf) shares the same cached login with the CLI: OpenAI’s auth page says that if you log out from either one, you sign in again the next time you start the CLI or the extension.

Remove the program

Installed withRemove with
npm (npm install -g @openai/codex)
npm uninstall -g @openai/codex
Bun
bun remove -g @openai/codex
Homebrew (brew install --cask codex)
brew uninstall --cask codex
WinGet
winget uninstall --id OpenAI.Codex
Install script, macOS or Linux
The symlink, the managed folder and the profile block, below
Install script, Windows (PowerShell)
The install folder, the managed folder and the PATH entry, below
A binary from GitHub releases
Delete the file wherever you put it

The npm, Bun and Homebrew commands are the ones OpenAI’s own install script runs when it removes a conflicting copy. If npm uninstall -g fails with EACCES, the global folder is owned by root; the Codex update guide explains that case. The Homebrew cask has a --zap stanza, but it only removes ~/.codex if the folder is empty, so it will not delete your data for you. The WinGet package is a portable zip from the GitHub release; WinGet’s --purge option deletes all files and directories in the package directory.

The install script on macOS or Linux

curl -fsSL https://chatgpt.com/codex/install.sh | sh puts the real files in ~/.codex/packages/standalone/ and makes ~/.local/bin/codex a symlink into it (another folder if you set CODEX_INSTALL_DIR). On a Mac it adds a second symlink, codex-code-mode-host, beside it. The script has no uninstall option. Remove what it made:

readlink ~/.local/bin/codex          # check it points into ~/.codex/packages/standalone
rm -f ~/.local/bin/codex ~/.local/bin/codex-code-mode-host
rm -rf ~/.codex/packages/standalone
Copied

If you installed with CODEX_INSTALL_DIR or CODEX_HOME set, put those folders in place of ~/.local/bin and ~/.codex: the readlink output shows the real packages/standalone folder, and that is the one to delete.

If the folder was not already on your PATH, the script also added a PATH line to one shell profile, chosen by your OS and $SHELL: ~/.zprofile (zsh on macOS), ~/.bash_profile (bash on macOS), ~/.zshrc (zsh on Linux), ~/.bashrc (bash on Linux) or ~/.profile for other shells. It sits between two marker lines:

# >>> Codex installer >>>
export PATH="/home/you/.local/bin:$PATH"
# <<< Codex installer <<<
Copied

Find it with:

grep -n "Codex installer" ~/.zprofile ~/.bash_profile ~/.zshrc ~/.bashrc ~/.profile 2>/dev/null
Copied

No match means the script added nothing. Otherwise delete the three lines in an editor. Keep them if other programs you use live in ~/.local/bin, since removing the line takes that folder off your PATH. Open a new shell afterwards.

The install script on Windows

The PowerShell installer makes %LOCALAPPDATA%\Programs\OpenAI\Codex\bin a junction (a folder link) into %USERPROFILE%\.codex\packages\standalone, where the program itself lives, and adds that bin path to the front of your user PATH. In PowerShell, remove the link first, then its now-empty parent, then the program:

cmd /c rmdir "$env:LOCALAPPDATA\Programs\OpenAI\Codex\bin"   # removes the link only
cmd /c rmdir "$env:LOCALAPPDATA\Programs\OpenAI\Codex"       # refuses if anything else is in it
Remove-Item -Recurse -Force "$env:USERPROFILE\.codex\packages\standalone"

# take the folder off your user PATH
$bin = "$env:LOCALAPPDATA\Programs\OpenAI\Codex\bin"
$p = ([Environment]::GetEnvironmentVariable("Path", "User") -split ";") | Where-Object { $_ -and $_ -ne $bin }
[Environment]::SetEnvironmentVariable("Path", ($p -join ";"), "User")
Copied

You can also delete that PATH entry by hand in your account’s environment variables. Open a new terminal for the change to apply. If you set CODEX_INSTALL_DIR or CODEX_HOME when installing, use those folders in place of the defaults; with CODEX_INSTALL_DIR, that folder is itself the link, so remove it with the first line and skip the second. A Codex installed inside WSL is a separate Linux install: remove it from the WSL terminal with the Linux steps. Codex on Windows covers how the two sit side by side.

A binary from GitHub releases

The release archives hold a single file named for the platform, such as codex-x86_64-unknown-linux-musl, which the README suggests renaming to codex. Wherever you moved it (often /usr/local/bin or ~/.local/bin), delete that file; command -v codex shows where it is. Use sudo only if it is in a system folder.

What ~/.codex holds, and removing it

Everything above leaves Codex’s home folder in place, so a reinstall picks up your settings and history. The home is ~/.codex (on Windows %USERPROFILE%\.codex), or wherever CODEX_HOME points. Going by OpenAI’s config docs and the 0.172 source, it holds:

Path under ~/.codexWhat it is
config.toml, profile files, hooks.json
Your settings and hooks
auth.json
Your login, with file storage; treat it like a password
AGENTS.md, AGENTS.override.md
Your global instructions
history.jsonl
Saved session history, if history persistence is on
sessions/, archived_sessions/
Session transcripts, current and archived
memories/
Memories, if you turned them on
log/
Logs (unless log_dir moves them)
packages/standalone/
The program itself, for an install-script install

The ChatGPT desktop app (where the Codex app now lives) uses the same home folder as the CLI on Windows, and the VS Code extension shares the CLI’s configuration, so deleting the folder resets those too. Remove them first if you want them gone, and back up anything you wrote yourself, such as AGENTS.md or config.toml. Then:

# Optional, and permanent: there is no undo
rm -rf ~/.codex
Copied

On Windows, in PowerShell:

# Optional, and permanent: there is no undo
Remove-Item -Recurse -Force "$env:USERPROFILE\.codex"
Copied

If you set CODEX_HOME or log_dir, delete those folders too, and remove the CODEX_HOME line from your shell profile. An AGENTS.md inside a project belongs to the project and is often committed for a whole team: leave it unless it is yours alone. The config.toml guide shows which settings files Codex reads and where, if you want to keep some and drop others.

The VS Code extension and the desktop app

The IDE extension is a separate install with its own bundled Codex executable, so it is removed on its own. Its ID is openai.chatgpt. In VS Code, open the Extensions view, click the Manage gear on the Codex entry and choose Uninstall, or from a terminal:

code --uninstall-extension openai.chatgpt
Copied

In Cursor or Windsurf, use the same Extensions view. Sign out from the extension’s profile menu first (Log out) if the CLI is already gone. The Codex in VS Code guide covers the extension in detail.

The Codex app is now part of the ChatGPT desktop app. Log out from its profile menu, then remove it as you would any app: drag it from Applications to the Trash on a Mac; on Windows, uninstall ChatGPT under Settings, Apps, or with winget uninstall --id 9PLM9XGG6VKS -s msstore, the ID OpenAI gives for installing it. Removing the app does not remove the CLI or ~/.codex. More on what the app is: the Codex app.

Check nothing is left

hash -r; command -v codex   # prints nothing once it is gone
which -a codex              # every codex still on the PATH
npm -g ls @openai/codex     # no codex listed once the npm copy is gone
ls -d ~/.codex ~/.local/bin/codex 2>/dev/null
Copied

If a codex is still found, it is a second install: remove it by its own route from the table above and check again. The last line shows what is still on disk, which after a program-only uninstall is your ~/.codex folder, as intended. On Windows, run where.exe codex in a new terminal: it finds no file once every copy is gone. To put Codex back later, or to switch to another install method rather than remove it, installing Codex CLI has every route.

Run Codex on an always-on developer pod.

A developer pod is a permanent cloud computer (VPS), set up and secured for you, with your pick of Claude Code, Codex, OpenCode, Pi, Hermes and OpenClaw installed. Run more agents at once than your laptop can hold, and keep them working when it’s closed. From $24 a month, built in about ten minutes.