Install with a coding agent
Steps a coding agent follows to install Grain on a Mac, 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 Mac. Follow the steps in order. Before any step that needs the person, tell them what is about to happen. macOS on Apple Silicon.
1. Check what is already there
command -v grain && grain setup --check --jsonIf the output has "ready":true, tell the person Grain is already set up and stop.
2. Install
brew install --cask greenfield-inc/tap/grainIf Homebrew is missing or the install fails, tell the person to install Grain from https://rungrain.com following Install, then continue at step 3.
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 Mac, 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 setupRun 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 --jsonCheck "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 Mac's access in the Grain app under Settings → Integrations.