Library/Start Here·Session 7 of 7

Set up Grok Build (Mac and Windows)

20 minSaves $25/mo

Grok Build is xAI's coding agent, and the install is one line pasted into a terminal. You do not need IT. You need a terminal window, an active Grok account, and twenty minutes.

This lesson covers Grok Build only. If you have not picked a tool yet, see the general install lesson first, which compares Grok Build against Codex and Claude Code.

What you will use

  • A Mac (macOS 13 or later) or a Windows 10/11 PC
  • An internet connection
  • A Grok / xAI account that can use Grok Build
  • A second AI chat window (any one) to double-check the install command before you run it

Step 1: Confirm access

Sign in at grok.com or x.ai. Grok Build is not automatically included on every plan, so before you install anything, check the install page at x.ai/cli. It lists current access for your account. If it does not show you as eligible, that is your answer: upgrade first, then come back to Step 2. Keep that browser tab logged in. The first time you launch the tool, it opens a browser to finish login.

Step 2: Open the right window

Mac: press Command + Space, type Terminal, press Enter. A window opens with a blinking cursor. Lines usually start with % or $.

Windows: click Start, type PowerShell, and open Windows PowerShell, not Command Prompt. The prompt should read PS C:\Users\.... If you see C:\Users\... with no PS in front, you are in Command Prompt. Close it and open PowerShell instead.

Leave this window open. You are about to paste one command into it.

Step 3: Verify before you run

Do not paste an install command into a terminal just because it showed up somewhere. Before you run anything below, paste the exact line into a second AI chat and ask: "what does this command do, and what domain does it download from?" A one-line answer telling you it fetches an install script from x.ai and runs it is what you want to see.

Then check the line yourself. The domain has to be x.ai. Every command and link in this academy for AI coding agents points to one of three places: claude.ai, chatgpt.com, or x.ai. Nowhere else. If a command you were given points anywhere else, stop and do not run it.

Step 4: Install

Copy the line for your operating system. Paste it into the window from Step 2. Press Enter. Text will scroll. Wait until it stops.

Mac:

curl -fsSL https://x.ai/cli/install.sh | bash

Windows (PowerShell):

irm https://x.ai/cli/install.ps1 | iex

When it finishes, close the terminal window completely and open a new one. Then check that the command exists:

grok --version

If the new window says the command is not found, the installer added itself to PATH but this window was opened before that happened. A fresh window almost always fixes it.

Step 5: First run

  1. Make a folder on your Desktop called ai-setup-test (Finder or File Explorer is fine).
  2. In your new terminal, go there.

Mac:

cd ~/Desktop/ai-setup-test

Windows:

cd $HOME\Desktop\ai-setup-test
  1. Type grok and press Enter.
  2. The first launch opens your browser. Approve the login there, then return to the terminal.
  3. When you see a prompt, type this exactly and press Enter:

Create a file named hello.txt in this folder. The file should contain the sentence: I am set up.

Approve the file write if it asks.

Open the folder in Finder or File Explorer. You should see hello.txt. Open it. You should see that sentence. You did not type the file by hand. Grok Build did.

Step 6: If it fails

  • "Access denied" or the install page says you are not eligible: Grok Build is not enabled on your current plan. Go back to x.ai/cli, check what your account needs, upgrade if you decide to, then repeat Step 4.
  • "Command not found" after installing: you are almost always in the same terminal window the installer ran in. Close it completely, open a brand new window, and run grok --version again.

You are done when...

You can open a new terminal, cd into any folder, run grok, and get a reply. The hello.txt file exists on disk with the sentence you asked for. That is a working Grok Build install, verified by a file it created, not by you taking the install script's word for it.


Template included: Members get a one-page Grok Build setup card: both OS install commands, the verify-before-you-run checklist, and the first prompt to confirm the install worked. Find it in your member dashboard under Templates.

Want it done for you?

Short on time? Alliance Optimal will implement this end to end, wired into your stack, and hand you the keys.

Implementation engagements from $2,500
Set up Codex (Mac and Windows)