Skip to content

Instantly share code, notes, and snippets.

@daniel-farina
daniel-farina / opencode-gemma4-ollama-macos.md
Last active April 25, 2026 07:19
Running OpenCode with Gemma 4 26B on macOS via llama.cpp - fixing tool calling

Running OpenCode with Gemma 4 26B on macOS (via llama.cpp)

As of April 2026, Gemma 4 tool calling is broken in Ollama v0.20.0 (ollama/ollama#15241) - the tool call parser fails and streaming drops tool calls entirely. OpenCode also has issues with local OpenAI-compatible providers (anomalyco/opencode#20669, #20719).

This guide documents a working setup using:

  • llama.cpp (built from source with PR #21326 template fix + PR #21343 tokenizer fix) instead of Ollama
  • OpenCode built from source with PR #16531 tool-call compatibility layer

Tested on macOS Apple Silicon (M1 Max, 32GB) on April 2, 2026.