Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(brain): find Homebrew at the Intel prefix for the macOS Ollama install

rubenluetke10-beep6fe7d0f6eba6
diff --git a/jarvis/brain/ollama_runtime.py b/jarvis/brain/ollama_runtime.py
index b94aef7692..63ae8216e5 100644
--- a/jarvis/brain/ollama_runtime.py
+++ b/jarvis/brain/ollama_runtime.py
@@ -406,11 +406,15 @@ def _install_windows() -> str:
def _install_macos() -> str:
"""Homebrew is the one automatable path; a dmg drag cannot be scripted honestly."""
- brew = shutil.which("brew") or (
- "/opt/homebrew/bin/brew"
- if Path("/opt/homebrew/bin/brew").exists()
- else ""
- )
+ brew = shutil.which("brew")
+ if not brew:
+ # Both default prefixes: /opt/homebrew (Apple Silicon) and /usr/local
+ # (Intel). A GUI-launched app can miss either on PATH; probing only
+ # the Silicon prefix told Intel Macs WITH Homebrew "No Homebrew".
+ for candidate in ("/opt/homebrew/bin/brew", "/usr/local/bin/brew"):
+ if Path(candidate).exists():
+ brew = candidate
+ break
if not brew:
raise RuntimeError(
"No Homebrew on this Mac, and the Ollama.dmg needs a manual "
diff --git a/tests/unit/brain/test_ollama_runtime.py b/tests/unit/brain/test_ollama_runtime.py
index fc8b220e29..d650f10edb 100644
--- a/tests/unit/brain/test_ollama_runtime.py
+++ b/tests/unit/brain/test_ollama_runtime.py
@@ -141,6 +141,24 @@ def test_macos_without_brew_refuses_with_the_dmg_pointer(monkeypatch) -> None:
ollama_runtime._install_macos()
+def test_macos_intel_brew_prefix_is_found_without_path(monkeypatch) -> None:
+ """Homebrew lives at /usr/local on Intel Macs; a GUI-launched app whose
+ PATH misses it must still find brew there instead of refusing."""
+ monkeypatch.setattr(ollama_runtime.shutil, "which", lambda name: None)
+ monkeypatch.setattr(
+ ollama_runtime.Path,
+ "exists",
+ lambda self: self.as_posix() == "/usr/local/bin/brew",
+ raising=False,
+ )
+ commands: list[list[str]] = []
+ monkeypatch.setattr(
+ ollama_runtime, "_run_command", lambda cmd, timeout: commands.append(cmd)
+ )
+ assert ollama_runtime._install_macos() == "homebrew"
+ assert commands[0][0] == "/usr/local/bin/brew"
+
+
def test_windows_prefers_winget(monkeypatch) -> None:
monkeypatch.setattr(
ollama_runtime.shutil,