--- summary: "CodexBar CLI for fetching usage from the command line." read_when: - "You want to call CodexBar data from scripts or a terminal." - "Adding or modifying Commander-based CLI commands." - "Aligning menubar and CLI output/behavior." --- # CodexBar CLI A lightweight Commander-based CLI that mirrors the menubar app’s data paths (Codex web/RPC → PTY fallback; Claude web by default with CLI fallback and OAuth debug). Use it when you need usage numbers in scripts, CI, or dashboards without UI. ## Install - In the app: **Preferences → Advanced → Install CLI**. This symlinks `CodexBarCLI` to `/usr/local/bin/codexbar` and `/opt/homebrew/bin/codexbar`. - From the repo: `./bin/install-codexbar-cli.sh` (same symlink targets). - Manual: `ln -sf "/Applications/CodexBar.app/Contents/Helpers/CodexBarCLI" /usr/local/bin/codexbar`. ### Linux install - Homebrew (Linuxbrew, Linux only): `brew install steipete/tap/codexbar`. - Download `CodexBarCLI-v-linux-.tar.gz` from GitHub Releases (x86_64 + aarch64). - Extract; run `./codexbar` (symlink) or `./CodexBarCLI`. ``` tar -xzf CodexBarCLI-v0.17.0-linux-x86_64.tar.gz ./codexbar --version ./codexbar usage --format json --pretty ``` ## Build - `./Scripts/package_app.sh` (or `./Scripts/compile_and_run.sh`) bundles `CodexBarCLI` into `CodexBar.app/Contents/Helpers/CodexBarCLI`. - Standalone: `swift build -c release --product CodexBarCLI` (binary at `./.build/release/CodexBarCLI`). - Dependencies: Swift 6.2+, Commander package (`https://github.com/steipete/Commander`). ## Command - `codexbar` defaults to the `usage` command. - `--format text|json` (default: text). - `codexbar cost` prints local token cost usage (Claude + Codex) without web/CLI access. - `--format text|json` (default: text). - `--refresh` ignores cached scans. - `--provider codex|claude|zai|gemini|antigravity|cursor|factory|copilot|kimi|kimik2|both|all` (default: your in-app toggles; falls back to Codex). - `--account