HomeGrok Build and the Grok CLI
Grok Build and the Grok CLI
Grok Build is xAI’s coding agent in the terminal. Install it from x.ai, run grok inside a project, and sign in with a browser or an API key.
Updated 2026-09-25

Grok build and grok CLI are the same install. xAI documents a shell script for macOS, Linux, and Git Bash, and a PowerShell script for Windows. The binary is named grok. A second command, agent, is wired to the same program. This is not the Windows chat download. The chat app stays on grok.com. The CLI edits a codebase.
Install
On macOS or Linux, xAI’s install command is curl -fsSL https://x.ai/cli/install.sh | bash. On Windows PowerShell it is irm https://x.ai/cli/install.ps1 | iex. Then run grok --version. The script installs under ~/.grok/bin. If the shell cannot find grok, the installer prints the PATH line to add. Restart the terminal after that. You can pin a version by passing it to the bash script, and you can set GROK_CHANNEL to stable, alpha, or enterprise. Stable is the default.
The GitHub repository xai-org/grok-build publishes the same commands and notes that official installs ship the binary as grok, while a from-source build produces xai-grok-pager. Building from source needs the Rust toolchain pinned in that repo and DotSlash. Most people should use the script, not a source build. Enterprise docs also mention npm install -g @xai-official/grok when a network can reach npm and cannot reach x.ai for the shell script.
Sign in and run it
cd into the project and run grok. The first launch opens a browser for xAI login. On a server with no browser, the enterprise docs list grok login --device-auth, or an API key in the environment: export XAI_API_KEY and then grok. A one-shot prompt is grok -p "Review this diff" with flags such as --output-format json. Do not put the API key in a screenshot or a git repo. The key is a billing credential. Text rates for the coding model live on the API pricing page. The docs have listed grok-build-0.1 and, on the Build overview, grok-4.5 as the model behind the agent. The marketing site has also said Grok 4.6 inside Build. Trust grok --version and the model line in your session over a stale blog.
- Browser login: default on a laptop.
- Device code: SSH and containers.
- API key: CI and scripts. It does not refresh the way OAuth does.
- Hosts the CLI calls include cli-chat-proxy.grok.com and auth.x.ai. Blocking them breaks sign-in.
What people mean by Grok agent
Grok agent in this context is the coding agent you just installed. Imagine’s parallel agents, which run several video prompts, are a different screen and are covered in the video guide. Custom chat characters are the companions. If a tutorial says “agent” and then shows a repository, it means Build. If it shows a camera, it means Imagine.
How to install Grok, when the next sentence is about a repo, is the script above. When the next sentence is about chatting, ignore the script and open the website. Mixing them up is the main reason a Windows user ends up with a terminal tool they did not want. SuperGrok Plus lists higher Build usage on the pricing page. A free xAI account can still install the binary. The meter depends on the plan or the API key’s billing account.
Skills and files
Grok skills are reusable instructions the agent can load. They are not a download that replaces the CLI. Files you want the chat app to read are a different feature, Grok files. The CLI already sees the working directory you started it in. Give it a real checkout, not a folder of secrets you did not mean to expose. Review the diff before you commit. The agent can be wrong with full confidence.
A first session that does not wreck the repo
Clone a scratch copy. Run the tests so you know the baseline. Start grok and ask for a change you can judge in one file, such as a clearer error string. Read the diff. Run the tests again. That loop is the product. Skipping the read is how an agent “fixes” a function by deleting the assertion. The official docs show one-shot flags for CI. Use those only after the interactive loop is boring, and point CI at a branch, not at main.
Keys and hosts are the other half of install. XAI_API_KEY in the environment is for headless runs. OAuth is for your laptop. Do not copy a key into ~/.grok and also commit that directory. Enterprise networks must allow auth.x.ai and the CLI proxy or login never finishes. The docs list npm as a fallback when the curl host is blocked. Pick one install path and stay on it so updates are predictable. grok --version is the check after either path.
Build usage on SuperGrok Plus is a consumer meter. API tokens are a different bill, with grok-build class rates on docs.x.ai. If a long agent run surprises you, look at which credential the session used before you blame the $30 plan. Chat on grok.com did not do that work. The terminal did.
When the agent proposes a new dependency, read the package name character by character. Typosquats are a real failure mode for coding agents that “helpfully” install. Prefer the dependency your repo already uses. If tests need a network call to api.x.ai, that call belongs in a dev environment with a capped key, not in a production secret baked into the binary the agent just edited. Scan the diff for keys before you commit. The install docs are about getting grok on your PATH. They are not a reason to skip review.
Questions
How do I install the Grok CLI?
macOS and Linux: curl -fsSL https://x.ai/cli/install.sh | bash. Windows PowerShell: irm https://x.ai/cli/install.ps1 | iex. Then run grok --version.
Is Grok Build the same as the Grok app?
No. Build is a terminal coding agent. The chat, Imagine, and voice apps are grok.com and the mobile apps.
How does Grok Build sign in?
A browser login on first launch, a device code on headless machines, or an XAI_API_KEY for CI. Do not commit the key.
Does SuperGrok include Grok Build?
The pricing page lists Grok Build as a product row, and SuperGrok Plus explicitly raises Build usage. Confirm the meter on your plan before a long run.
Related guides
- Grok Download for Windows and Android
xAI ships Grok on the web, iOS, and Android. Windows uses the browser. Avoid unofficial APK files. The CLI install is a separate tool.
- Grok Files, Connectors, and Skills
Grok files are chat uploads. Connectors link outside accounts and ship on the free plan. Skills are reusable instructions, especially in Grok Build.
- Grok Price and SuperGrok Plans
SuperGrok is $30 a month and SuperGrok Plus is $100 on x.ai/pricing. See Lite, Heavy, the free tier, and what a trial actually is.
- Grok AI Login and Sign In
Sign in to Grok on grok.com or in the official app. This site cannot log you in. Account creation, Grok 4 sign-in, and failed sessions.