Getting Started
Grok Build
Grok Build is a coding agent for the terminal. Use it as an interactive TUI, headlessly in scripts or bots, or through the Agent Client Protocol (ACP) in other apps.
Install
Run the command for your system. It downloads the latest stable release and adds grok to your PATH:
curl -fsSL https://x.ai/cli/install.sh | bash
Run Grok
Start Grok in your project folder:
Bash
cd your-project
grok
If your shell can't find grok, open a new terminal.
On first launch, Grok opens your browser to sign in, and keeps you signed in after that. If there is no browser, use another method:
| Where you're working | Sign in with | Command |
|---|---|---|
| Your own machine | Browser | grok |
| SSH or a remote machine | Device code | grok login --device-auth |
| CI and scripts | API key | export XAI_API_KEY="xai-..." |
For every sign-in option, see Authentication.
Ask your first question
At the prompt, start with a question that works in any repository:
Text
Explain this repo.
Grok reads the files it needs, shows each step as it runs, and answers with a summary of the codebase. Once you see that, the install, sign-in and project are all working.
Then point it at a file with @:
Text
@src/main.rs Walk me through this file.
In a session, /usage shows your credit usage.
Run headlessly
Headless mode is ideal for scripts, automations, or integration into other apps:
Bash
grok -p "Explain this codebase"
grok -p "Explain the architecture" --output-format streaming-json
For its flags and output formats, see Headless and Scripting.
Update
One command updates Grok for both interactive and headless use:
Bash
grok update
To see what each release changed, read the Changelog.
Requirements
- macOS (Apple silicon or Intel) or Linux (x86_64 or arm64). On Windows, use PowerShell, Git Bash or WSL.
- A terminal, and a project folder to run Grok in.
- A SpaceXSI account to sign in with, or an API key.
Features
- Plugins, skills and MCP servers. Extend what Grok can do.
- Agent Dashboard. Every session at a glance, and which agents need input.
- Modes and Commands. Switch modes with Shift+Tab and use slash commands.
- CLI Reference. The
groksubcommands and common flags.
Next
- Custom Models. Use any model through
~/.grok/config.toml. - Grok 4.7 on the API. Call the model from your own agent or tool.
- Enterprise Deployments
- Grok Bot — AI teammates on a cloud computer