Local AI Coding Agent Setup#

This guide documents the steps taken to install and configure Claude Code to run 100% locally on the Mac Studio M4 (64GB) using Ollama, ensuring complete privacy for local folders and Obsidian vaults.


1. Prerequisites (Mac Studio)#

  • Hardware: Mac Studio M4 (64GB Unified Memory).
  • Environment: Node.js v25.8.0 installed.
  • Local Brain: Ollama installed and running.

2. Install Claude Code (Native)#

Instead of using npm, we used the official native installer from Anthropic for better performance and signed binary security.

# Download and run the official installer
curl -fsSL [https://claude.ai/install.sh](https://claude.ai/install.sh) | sh

# Add to PATH (if not done automatically)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Verify the installation:

claude --version

3. Pull High-Performance Coding Model#

For a coding agent to work effectively on complex tasks (like Traefik/Pangolin troubleshooting), a specialized “Coder” model is required.

# Pull the 32B parameter model (optimized for 64GB RAM)
ollama pull qwen2.5-coder:32b

4. Privacy Shield: Local-Only Configuration#

To prevent Claude Code from calling home to Anthropic or opening a browser for cloud login, we force the CLI to use the local Ollama API.

Temporary Session (Run in Terminal):

# 1. Point to the SPECIFIC v1 messages endpoint
export ANTHROPIC_BASE_URL="http://localhost:11434"
export ANTHROPIC_AUTH_TOKEN="ollama"
export CLAUDE_CODE_DISABLE_TELEMETRY=1

# 2. Force all internal "roles" to use your 32b model
export ANTHROPIC_DEFAULT_HAIKU_MODEL="qwen2.5-coder:32b"
export ANTHROPIC_DEFAULT_SONNET_MODEL="qwen2.5-coder:32b"
export ANTHROPIC_DEFAULT_OPUS_MODEL="qwen2.5-coder:32b"

# 3. Launch Claude Code
cd Obsidian
claude --model qwen2.5-coder:32b
# Check your environment variables
echo $ANTHROPIC_BASE_URL
echo $ANTHROPIC_AUTH_TOKEN

## You should see:
#http://localhost:11434
#ollama

You should see:

http://localhost:11434
ollama

5. Usage & Interaction Rules#

When running the agent in your private folders or server directories, follow the established Operational Safeguards:

Launch Command#

#On MacStudio
cd Obsidian
claude --model qwen3:30b
# Initiate - will creat claude.md file in folder
/init