Each install path has a matching uninstall path. The uninstall scripts are surgical - they remove only the configuration the matching install script wrote, and leave everything else in the file untouched. They are idempotent: re-running on a clean file is a no-op (exit 0).
Claude Code MDM installs (root on macOS/Linux, SYSTEM on Windows) are a special case. Those installs write a self-contained drop-in fragment (managed-settings.d/10-torii-otel.json) that Torii owns outright - so the uninstall in elevated/SYSTEM mode is a clean backup-and-delete of that file rather than a key-by-key strip. The user-scope file is still cleaned key-by-key as described below, since admins may have a curl|bash user-scope install on the same machine. Pre-migration legacy managed-settings.json files are NOT touched - if you have one of those from before the drop-in migration, it stays in place; the fragment wins at runtime anyway.
What the uninstaller removes (and preserves)
| Tool | What's removed | What's preserved |
|---|---|---|
| Claude Code | The 10 OTEL env keys the install script wrote (only those). | Any other keys in env. The rest of settings.json entirely (any hooks block the customer set is untouched). |
| Gemini CLI | The entire .telemetry block (replaced with { "enabled": false }). |
Every other key in settings.json. Note: Gemini owns the whole .telemetry object, so the uninstall takes it as a unit. |
| Codex CLI | The block between # BEGIN AI_OTEL_MANAGED and # END AI_OTEL_MANAGED, including the markers. |
Every other line in config.toml. Any unmanaged [otel] section that was already there is untouched. |
Uninstall scripts
| Tool | macOS | Linux | Windows |
|---|---|---|---|
| Claude Code | uninstall-claude-code-telemetry-macos.sh |
uninstall-claude-code-telemetry-linux.sh |
uninstall-claude-code-telemetry.ps1 |
| Gemini CLI | uninstall-gemini-cli-telemetry-macos.sh |
uninstall-gemini-cli-telemetry-linux.sh |
uninstall-gemini-cli-telemetry.ps1 |
| Codex CLI | uninstall-codex-cli-telemetry-macos.sh |
uninstall-codex-cli-telemetry-linux.sh |
uninstall-codex-cli-telemetry.ps1 |
All uninstall scripts are published at https://assets.toriihq.com/otel/latest/<name>.
Uninstall via MDM
Same workflow as the install (see Rolling out LLM token tracking via MDM):
- Create a new MDM policy that runs the uninstall script.
- Target it at the same device group that received the install policy.
- Either run-once or leave as a recurring policy - re-runs on already-clean files are no-ops.
- Once the rollback has reached all machines, retire (don't just disable) the original install policy so it doesn't re-install on the next check-in.
Uninstall via one-liner
For a single workstation:
# Claude Code (Linux) curl -fsSL https://assets.toriihq.com/otel/latest/uninstall-claude-code-telemetry-linux.sh | bash # Gemini CLI (Linux) curl -fsSL https://assets.toriihq.com/otel/latest/uninstall-gemini-cli-telemetry-linux.sh | bash # Codex CLI (Linux) curl -fsSL https://assets.toriihq.com/otel/latest/uninstall-codex-cli-telemetry-linux.sh # Windows PowerShell example iwr -useb 'https://assets.toriihq.com/otel/latest/uninstall-claude-code-telemetry.ps1' ` -OutFile "$env:TEMP\uninstall-claude-code-telemetry.ps1" & "$env:TEMP\uninstall-claude-code-telemetry.ps1"
Replace -linux.sh with -macos.sh on macOS.
Uninstall by manually editing the config file
If you installed by manually editing the config file (see Manual install for LLM token tracking), you can undo the change the same way:
-
Claude Code: open
~/.claude/settings.json(or%USERPROFILE%\.claude\settings.json). Remove the ten env keys listed in What the LLM token tracking install scripts do. Leave everything else untouched. -
Gemini CLI: open
~/.gemini/settings.json. Replace the"telemetry"block with"telemetry": { "enabled": false }or delete the key entirely. -
Codex CLI: open
~/.codex/config.toml. Delete the lines from# BEGIN AI_OTEL_MANAGEDthrough# END AI_OTEL_MANAGEDinclusive.
Backups
The uninstall scripts create their own timestamped backup before modifying anything:
~/.claude/settings.json.ai-otel-backup-YYYYMMDD-HHMMSS ~/.gemini/settings.json.ai-otel-backup-YYYYMMDD-HHMMSS ~/.codex/config.toml.ai-otel-backup-YYYYMMDD-HHMMSS
The path of each backup file is printed to stderr (backup: <path>) immediately after it's created - useful when collecting script output through MDM agent logs.
If you need to roll back the uninstall (e.g., you removed too much by mistake), one of these backups is the previous state of the file.
What stays after uninstall
The uninstall does not remove:
- The accumulated backup files (
*.ai-otel-backup-*). Clean those up separately if you want. - The Linux helper binary - it's already been deleted on exit by the install script. There's nothing on disk to clean up.
- Any data already ingested by Torii. The Torii AI Telemetry dashboard continues to show historical events for the retention period of your account.
Uninstalling from the collector side
If you wired Torii into your existing OTEL collector (no install scripts ever ran on workstations):
- Remove the
otlphttp/toriiexporter definition from the collector config. - Remove
otlphttp/toriifrom every pipeline'sexporterslist. - Optionally remove the
TORII_INGEST_TOKENenvironment variable from the collector's secret store. - Reload the collector. Workstations stop being copied to Torii on the next session.
Verifying uninstall
After running the uninstall:
- Close any open CLI sessions on the machine.
- Open a new terminal and run the per-tool test command from Verifying LLM token tracking by sending a test event.
- Watch the AI Telemetry event tail in Torii - no new event should appear from that user/machine.
- The Status card will transition to Stale once all configured workstations have been uninstalled.