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 node2 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-agent3 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"] }
]
}
}
}
EOF4 Model Context Protocol (MCP) Setup#
To enable MCP support in the Pi coding agent, install the MCP adapter package:
4.1 Install the MCP Adapter#
pi install npm:pi-mcp-adapterThe compiler pipeline will automatically compile your active servers into the expected format and deploy them directly to ~/.pi/agent/mcp.json.
5 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.
5.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:latest5.2 Essential Interactive Session Commands#
- Switch Models: Type
/model gemma4-31b-32k:latestdirectly 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.