fix(installer): detect Apple Silicon GPU and use Homebrew for Ollama on macOS - #275
Conversation
…on macOS detect_gpu() only checks for nvidia-smi, which does not exist on macOS. Apple Silicon Macs have a unified GPU capable of running local models via Ollama, but the installer skips Ollama entirely because it assumes no GPU is present. Additionally, the Ollama install path uses the Linux-only ollama.com/install.sh script (apt-get/systemctl), which fails on macOS. Changes: - detect_gpu() now recognizes Apple Silicon (Darwin arm64) as a valid GPU - Add install_ollama_platform() helper that dispatches to Homebrew on macOS and the upstream install script on Linux Closes NVIDIA#260 (partially — addresses gaps 1 and 3) Tested on: macOS 15.x, Apple M-series, Docker Desktop
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
install.sh (1)
162-163: Simplify to idiomatic Homebrew pattern.
brew install ollamais Homebrew's standard way to install or upgrade a formula—it automatically upgrades if already installed (unlessHOMEBREW_NO_INSTALL_UPGRADEis set), and returns exit code 0 even when already installed. The fallback|| brew upgrade ollamaonly triggers on actual errors (network/download failures), which would fail identically on upgrade, making it ineffective. Simply usebrew install ollama.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@install.sh` around lines 162 - 163, Replace the non-idiomatic fallback logic using "brew install ollama || brew upgrade ollama" with the single canonical Homebrew invocation "brew install ollama"; update the snippet containing the "brew install ollama || brew upgrade ollama" line so it simply runs "brew install ollama" (this keeps behavior consistent with Homebrew's automatic upgrade semantics and avoids the ineffective || upgrade fallback).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@install.sh`:
- Around line 162-163: Replace the non-idiomatic fallback logic using "brew
install ollama || brew upgrade ollama" with the single canonical Homebrew
invocation "brew install ollama"; update the snippet containing the "brew
install ollama || brew upgrade ollama" line so it simply runs "brew install
ollama" (this keeps behavior consistent with Homebrew's automatic upgrade
semantics and avoids the ineffective || upgrade fallback).
|
Thanks for this contribution — you weren't alone here; #464 and #471 tackled the same macOS inference DNS gap from different angles. The installer has since been refactored into a thin bootstrap, and Ollama installation is no longer handled by Closing as superseded by the installer refactor. If you're hitting Ollama setup issues on Apple Silicon, the current path is documented in |
Summary
detect_gpu()now recognizes Apple Silicon (Darwin arm64) as a valid GPU, so the Ollama install/upgrade path is no longer skipped on macOS.install_ollama_platform()helper that usesbrew install ollamaon macOS instead of the Linux-onlyollama.com/install.shscript (which relies onapt-get/systemctl).get_vram_mb()already had a macOS fallback usingsysctl hw.memsize— it is now actually reachable sincedetect_gpu()no longer gates it out.Context
Relates to #260 (macOS/Apple Silicon Support Tracking — gaps 1 and 3).
On Apple Silicon Macs, the installer always prints
No GPU detected — skipping Ollama installationbecausedetect_gpu()only checks fornvidia-smi. Apple Silicon has a unified GPU fully capable of running local models via Ollama, and Ollama itself has native macOS/ARM64 support.Even if
detect_gpuwere bypassed, thecurl | shOllama installer is Linux-only and would fail on macOS.Changes
detect_gpu()nvidia-smiDarwin arm64curl | sh(Linux-only)brew install ollamaon macOSTest plan
Validated on macOS 15.x, Apple M4, Docker Desktop:
detect_gpureturns 0 on Apple Siliconinstall_ollama_platformuses Homebrew on macOSinstall_ollama_platformstill usescurl \| shon Linuxget_vram_mbcorrectly reports unified memory on macOS🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes