How to Detect OpenAI Codex CLI on Employee Laptops
Codex CLI is OpenAI's terminal coding agent. It installs as an npm package or with Homebrew, without admin rights, so software inventories rarely list it. Here are the traces it leaves on each OS, a one-minute read-only check, and the config.toml settings that turn an install into a finding.
What Codex CLI is and why security teams care
Codex CLI is OpenAI's open-source terminal coding agent. It reads the code in the folder it starts from, edits files, runs commands and starts MCP servers as the logged-in user, signing in with a ChatGPT account or an OpenAI API key. The same agent also runs in the Codex IDE extension and the Codex desktop app.
- Invisible installs. It is installed as the global npm package
@openai/codexor with Homebrew. Nothing lands in Programs and Features or/Applications. - Sandbox and approvals are user settings.
sandbox_mode = "danger-full-access"orapproval_policy = "never"in~/.codex/config.tomllets the agent run anything without asking. - Credentials on disk.
~/.codex/auth.jsonholds the sign-in, including an API key when one is used; session transcripts under~/.codex/sessionskeep whatever the agent read.
Where Codex CLI leaves traces
| Signal | Windows | macOS | Linux |
|---|---|---|---|
| npm global package | @openai/codex under %APPDATA%\npm\node_modules, shim in %APPDATA%\npm | @openai/codex under npm root -g | Same as macOS |
| Homebrew | - | codex in /opt/homebrew/bin or /usr/local/bin | Homebrew on Linux, if used |
| Process | codex (the npm package starts a native binary), or node with @openai/codex | Same | Same |
| User data | %USERPROFILE%\.codex | ~/.codex | ~/.codex |
| Moved data folder | The CODEX_HOME environment variable, when set, replaces ~/.codex | ||
| Project files | .codex/config.toml and AGENTS.md in a repository | ||
| IDE extension | openai.chatgpt in the VS Code (or Cursor, Windsurf) extensions folder | ||
Inside ~/.codex, config.toml holds sandbox and approval settings, MCP servers ([mcp_servers.*]), model providers and plugins; auth.json holds credentials; sessions/ holds transcripts by date; skills/ and prompts/ hold extensions. One trap: the Codex desktop app also runs a process called codex, from Codex.app on a Mac or an OpenAI.Codex Store package on Windows, and the desktop app and IDE extension share ~/.codex. Count a codex process as the CLI only when its path is an npm or Homebrew location; Kuntur reports the desktop app separately.
Check one machine
Both checks only read files and the process table. They send nothing over the network and change nothing, and they never print the contents of auth.json or config.toml.
Windows (PowerShell)
# Read-only, no network. Run as the user (not SYSTEM).
# 1. Installed? npm global package, then anything named codex on PATH
Test-Path "$env:APPDATA\npm\node_modules\@openai\codex"
Get-Command codex -ErrorAction SilentlyContinue | Select-Object Source
# 2. Running now? Path tells the CLI from the Codex desktop app (WindowsApps\OpenAI.Codex_*)
Get-Process -Name codex -ErrorAction SilentlyContinue | Select-Object Id, Path
# 3. Used? Session transcripts are written per day under sessions\
$c = if ($env:CODEX_HOME) { $env:CODEX_HOME } else { "$env:USERPROFILE\.codex" }
Get-ChildItem "$c\sessions" -Recurse -File -Filter '*.jsonl' -ErrorAction SilentlyContinue |
Sort-Object LastWriteTime -Descending | Select-Object -First 5 LastWriteTime, Name
# 4. Settings worth a finding (line numbers and patterns only, no values)
if (Test-Path "$c\config.toml") {
Select-String -Path "$c\config.toml" -Pattern 'danger-full-access', 'approval_policy\s*=\s*"never"', '^\[mcp_servers\.' |
Select-Object LineNumber, Pattern
}
macOS and Linux (bash)
# Read-only, no network. Run as the user.
# 1. Installed? PATH, npm global, Homebrew
command -v codex
ls -d "$(npm root -g 2>/dev/null)/@openai/codex" 2>/dev/null
brew list --versions codex 2>/dev/null
# 2. Running now? The executable path tells the CLI from Codex.app
for pid in $(pgrep -x codex); do ps -o pid=,comm= -p "$pid"; done
pgrep -fl '@openai/codex' # the npm launcher, runs under node
# 3. Used? Session transcripts are written per day under sessions/
CODEX_DIR="${CODEX_HOME:-$HOME/.codex}"
find "$CODEX_DIR/sessions" -type f -name '*.jsonl' -mtime -30 2>/dev/null | wc -l
# 4. Settings worth a finding (prints only the matched keys)
grep -noE 'danger-full-access|approval_policy[[:space:]]*=[[:space:]]*"never"|^\[mcp_servers\.[^]]+\]' \
"$CODEX_DIR/config.toml" 2>/dev/null
Many developers run Codex inside WSL on Windows, so also check WSL distros; How to find Claude Code and Codex in WSL has a script for that. With nvm, fnm or Volta, list ~/.nvm/versions/node/*/lib/node_modules/@openai too.
Settings worth a finding
| Setting | What it means | Kuntur finding |
|---|---|---|
sandbox_mode = "danger-full-access" | No sandbox: commands can touch the whole machine and the network | AGENT_PERMISSIONS_BYPASS |
approval_policy = "never" without a read-only sandbox | The agent never asks before running a command | AGENT_PERMISSIONS_BYPASS |
The same keys under [profiles.*] | A named profile that switches the guardrails off | AGENT_PERMISSIONS_BYPASS (per profile) |
[mcp_servers.*] | Programs or URLs the agent can call, often with tokens in env | MCP inventory and MCP_PLAINTEXT_SECRET |
[model_providers.*] with a custom base_url | Prompts and code go to an endpoint other than OpenAI | Listed as a model provider |
The --dangerously-bypass-approvals-and-sandbox flag (alias --yolo) does the same for one run without touching the file, so only process command lines from your EDR show it.
Find it across a fleet
The commands above answer the question for one laptop. Across a fleet, run the same read-only checks from the management tool you already use and collect one line per device. Each of these guides has a tested script that already includes Codex CLI:
- Windows with Intune: Detect AI tools with Intune Remediations (detection-only script, results in the device status column).
- Windows with NinjaOne: Inventory AI tools with NinjaOne (writes a summary to a device custom field).
- macOS with Jamf Pro: Find AI tools with a Jamf Pro extension attribute (plus a Smart Group to act on it).
- macOS with Iru (Kandji): Detect AI tools with an Iru custom script (with an allowlist).
Those scripts walk every profile under C:\Users or /Users, because MDM scripts usually run as SYSTEM or root, where %USERPROFILE% and ~ point at the wrong home folder. On Linux, run the bash checks through whatever configuration management you have (Ansible, Salt, a cron job) and loop over /home/* the same way.
How Kuntur detects Codex CLI
Kuntur's catalog identifies Codex CLI by the global npm package, the codex binary, its process and the ~/.codex data folder, and reports the Codex desktop app as a separate tool. The agent also reads config.toml for every user profile: sandbox and approval settings (including profiles), MCP servers, model providers, plugins, marketplaces and skills, plus project .codex/config.toml files.
To check one machine now, the free Kuntur scanner lists Codex CLI together with every other AI tool, extension, local model and MCP server it finds:
- Download scan.ps1.
- Read it. It's plain text; here's what it does.
- Check its SHA-256 against the published hash:
Get-FileHash .\scan.ps1 -Algorithm SHA256 - Run it:
powershell -ExecutionPolicy Bypass -File .\scan.ps1
Windows shortcut, if you trust the source (PowerShell)
irm https://app.kuntur.io/scan.ps1 | iexmacOS and Linux (Terminal)
curl -fsSL https://app.kuntur.io/scan.sh | shIt needs no account and no admin rights, writes an HTML report to the Desktop (or home folder) and uploads nothing. You can read scan.ps1 or scan.sh before running it; what it collects is documented.
Across a fleet, the Kuntur agent reports the same inventory for every user profile on Windows, macOS and Linux. You mark Codex CLI approved or unauthorized once for the organization, the dashboard shows which machines carry it, and every decision lands in an audit log.
Free for up to 5 endpoints. Pro is US$3 per endpoint per month (or US$30 per endpoint per year) for 10 to 30 endpoints. The trial needs no credit card. Kuntur detects and reports; it does not block or uninstall anything.
FAQ
- Where is Codex CLI installed?
- Usually as the global npm package
@openai/codex(under%APPDATA%\npm\node_moduleson Windows ornpm root -gelsewhere), or with Homebrew on macOS. Its configuration, credentials and session transcripts are in~/.codex, or whereverCODEX_HOMEpoints. - How do I check if Codex CLI is installed?
- Run
Get-Command codexon Windows orcommand -v codexon macOS and Linux, and look for the npm package@openai/codexand the~/.codexfolder. Check the path of anycodexprocess: the Codex desktop app uses the same name. - Which Codex settings turn off its guardrails?
sandbox_mode = "danger-full-access"andapproval_policy = "never"in~/.codex/config.tomlor one of its profiles, or the--dangerously-bypass-approvals-and-sandboxflag for a single run. Kuntur reports the settings asAGENT_PERMISSIONS_BYPASS.- Is it safe to read ~/.codex/auth.json during an audit?
- Check that it exists and when it changed, but do not print it: it holds the user's sign-in tokens or API key. The checks on this page only list file names, dates and matching setting names.
Sources
- OpenAI Codex CLI on GitHub (install, configuration, sandbox and approvals)
- OpenAI developers: Codex CLI
Detect other AI tools:
- How to detect Gemini CLI
- Claude Code traces per OS
- How to detect the ChatGPT desktop app
- MCP server inventory
- All AI tools
Related guides: