Install with a coding agent

Steps a coding agent follows to install Grain on macOS, Windows or Linux, sign the person in, and connect Claude Code and Codex.


This page is written for a coding agent (Claude Code or Codex) running on a person's computer: macOS, Windows or Linux. Follow the steps in order. Before any step that needs the person, tell them what is about to happen.

1. Check what is already there

command -v grain && grain setup --check --json

If the output has "ready":true, tell the person Grain is already set up and stop.

2. Install

On macOS or Linux:

curl -fsSL https://rungrain.com/install.sh | sh

On Windows, in PowerShell:

irm https://rungrain.com/install.ps1 | iex

On Linux the installer puts the AppImage in ~/Applications without sudo, and opens Grain once to set up its CLI. If Grain is already running, the installer quits it and reopens the new version, so tell the person first.

If the install fails, tell the person to install Grain from https://rungrain.com following Install, then continue at step 3. If grain is not found afterwards, open a new shell or add ~/.local/bin (Windows: %USERPROFILE%\.local\bin) to PATH.

3. Set up

First say to the person, in these words or close to them:

I am going to run Grain setup. Your browser will open a Grain page. Check that it names this computer, then sign in or create your account and choose Allow access. After that I will connect Claude Code and Codex, and Grain will open already signed in.

grain setup

Run this as a background command, or with a command time limit of at least 10 minutes, and read its output as it arrives.

  • A line with a /auth/desktop? link is the sign-in page. Give the person that link if their browser did not open.
  • "Timed out waiting for browser sign-in" means ask them to finish signing in, then run it again.
  • "Grain is ready." means done.

Use grain setup --claude or --codex only if the person asks for one agent. Use --no-open if you cannot open apps; then ask the person to open Grain themselves.

4. If you are sandboxed

Setup must open a browser and the Grain app, listen on 127.0.0.1, reach the Grain API, and run claude or codex plugin commands. If your sandbox blocks any of these, ask the person to allow grain setup to run outside it.

5. Confirm and hand back

grain setup --check --json

Check "ready":true. Tell the person: Grain is installed and signed in; start a new agent session to get the Grain tools; then try "Create a short welcome document in Grain."

Mention that they can review or revoke this computer's access in the Grain app under Settings → Integrations.