Who this is for
People who want xAI's coding agent in the terminal. Yes, a first-party CLI exists — product name Grok Build, command grok after install. Installer from x.ai/cli / docs.x.ai/build/overview. Raw api.x.ai calls remain for people building their own loops — that's a different job.
Which machine are you on? (saved from TA-01 if you picked there)
↑ Pick one to see only your install path. (Showing all until you do.)
The emergency brake
- Installer hangs or scrolls forever? Hold
Ctrl+ tapC, close the terminal, open a fresh one, try once more. - Scary red text? Copy the exact error — you'll need it for the fix table below or a consult. Red text is information, not damage.
OS matrix — pick your row
Compare all three OS paths (reference — your picker above already filtered the steps)
| macOS | Windows native | WSL | |
|---|---|---|---|
| Install | curl -fsSL https://x.ai/cli/install.sh | bash | irm https://x.ai/cli/install.ps1 | iex | Linux curl installer inside WSL |
| Auth | Browser on first grok | Same | Browser, or export XAI_API_KEY=... for headless/SSH |
| Headless | grok -p "Explain this codebase" (same everywhere) | ||
curl -fsSL https://x.ai/cli/install.sh | bash
irm https://x.ai/cli/install.ps1 | iex
Install, verify, and run once
- Install via the matrix.
cd your-project→ rungrok.- Complete browser login or set
XAI_API_KEY(get one at console.x.ai; never commit the key). - First prompt: “Explain this repo.”
- Optional:
grok -p "List the top-level folders"for non-interactive use.
Success check
groklaunches (interactive or-p)- Authenticated without committing a key
- One prompt answered about a real folder
Common failure modes
| Failure | Fix |
|---|---|
| No browser on remote SSH | grok login --device-auth per xAI auth docs, or use an API key |
| Key in shell history | Use env var for the session; revoke if pasted into a ticket |
| Expecting “Grok” browser UI only | This module is the local agent — different surface |
Don't buy / don't install yet
If you only need occasional Grok chat, the web/app UI may be enough — you don't owe xAI a local agent install. If you have no xAI access, skip without guilt.
Commands checked 2026-09-25 against xAI docs; if one fails, the official page wins.