vibehowto

Home / Your AI coding helper / Grok (xAI's version) / Install Grok CLI

Install Grok CLI

Updated Sep 18, 2026

Native installer first. Confirm grok --version, then log in in the browser.

Use the native installer. Skip npm i -g @xai-official/grok unless the script fails.

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

Close Terminal, open it again:

Terminal
grok --version

Log in

From any folder:

Terminal
grok

A browser window opens. Approve it. That is the subscription login.

Headless or CI: XAI_API_KEY in .env, never in chat. Mint it at console.x.ai if you need it. Do not prefix it NEXT_PUBLIC_.

Update later with grok update.

Next: first project.

Checklist

Saved in this browser. No account. Clearing site data wipes it.

Next: First project with Grok

Get new guides and videos by email

One email when something new is up. No spam. Unsubscribe anytime.