Installing and Launching Pi (pi.dev)#

Follow these steps to set up the Pi coding agent on your Mac Studio and link it straight to your custom local short-context models.


1 Environment Preparation#

Because Pi is a JavaScript terminal application, it runs on Node.js. If you do not have Node installed yet, use Homebrew to get it ready.

1.1 Install Node.js via Homebrew#

brew install node

2 Installation#

Install the official global Pi command-line tool. As noted in the documentation, we include the security flag to bypass unnecessary third-party package scripts.

2.1 Install the Pi CLI Securely#

npm install -g --ignore-scripts @earendil-works/pi-coding-agent

3 Configuration#

Pi reads a local models.json file to discover custom endpoints. We will map your newly built 32k models directly to Ollama’s local OpenAI-compatible port.

3.1 Create the Provider Mapping#

Execute this command to build Pi’s configuration directory and populate your model definitions:

mkdir -p ~/.pi/agent && cat << 'EOF' > ~/.pi/agent/models.json
{
  "providers": {
    "ollama-local": {
      "baseUrl": "http://localhost:11434/v1",
      "api": "openai-completions",
      "apiKey": "ollama",
      "models": [
        { "id": "qwen3.6-35b-32k:latest", "input": ["text"] },
        { "id": "gemma4-31b-32k:latest", "input": ["text", "image"] }
      ]
    }
  }
}
EOF
## MacBook Air
mkdir -p ~/.pi/agent && cat << 'EOF' > ~/.pi/agent/models.json
{
  "providers": {
    "ollama-local": {
      "baseUrl": "http://localhost:11434/v1",
      "api": "openai-completions",
      "apiKey": "ollama",
      "models": [
        { "id": "gemma4:e4b", "input": ["text"] },
        { "id": "gemma4:e2b", "input": ["text"] }
      ]
    }
  }
}
EOF

4 Launch Your First Session#

With everything mapped out, navigate to your iOS app directory and start the agent using your custom short-context Qwen layout.

4.1 Run the Session#

# Move into your iOS project directory
cd Antigravity/Gendash

# Launch Pi targeting your 32k Qwen model
pi --provider ollama-local --model qwen3.6-35b-32k:latest

4.2 Essential Interactive Session Commands#

  • Switch Models: Type /model gemma4-31b-32k:latest directly inside your live chat window to dynamically swap your active local engine without closing your workspace.
  • Compact History: If your conversation history grows long and your execution speeds drop, type /compact. Pi will instantly condense your prompt logs to free up your Mac Studio’s VRAM buffer.