Skip to content

fix(installer): detect Apple Silicon GPU and use Homebrew for Ollama on macOS - #275

Closed
XterraEngine-dev wants to merge 1 commit into
NVIDIA:mainfrom
XterraEngine-dev:fix/apple-silicon-gpu-detection-ollama
Closed

fix(installer): detect Apple Silicon GPU and use Homebrew for Ollama on macOS#275
XterraEngine-dev wants to merge 1 commit into
NVIDIA:mainfrom
XterraEngine-dev:fix/apple-silicon-gpu-detection-ollama

Conversation

@XterraEngine-dev

@XterraEngine-dev XterraEngine-dev commented Mar 18, 2026

Copy link
Copy Markdown

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.
  • Add install_ollama_platform() helper that uses brew install ollama on macOS instead of the Linux-only ollama.com/install.sh script (which relies on apt-get/systemctl).
  • get_vram_mb() already had a macOS fallback using sysctl hw.memsize — it is now actually reachable since detect_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 installation because detect_gpu() only checks for nvidia-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_gpu were bypassed, the curl | sh Ollama installer is Linux-only and would fail on macOS.

Changes

Function Before After
detect_gpu() Only checks nvidia-smi Also returns success on Darwin arm64
Ollama install Always uses curl | sh (Linux-only) Dispatches to brew install ollama on macOS

Test plan

Validated on macOS 15.x, Apple M4, Docker Desktop:

  • detect_gpu returns 0 on Apple Silicon
  • install_ollama_platform uses Homebrew on macOS
  • install_ollama_platform still uses curl \| sh on Linux
  • get_vram_mb correctly reports unified memory on macOS
  • Model pull selects appropriate size based on available memory
  • No regression on Linux (NVIDIA GPU path unchanged)

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Optimized Ollama installation with platform-specific methods (Homebrew for macOS, streamlined installer for other systems)
    • Apple Silicon devices now properly recognized and supported during system capability detection
  • Bug Fixes

    • Fixed installation flow to prevent unnecessary installation attempts on systems without GPU capability

…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
@coderabbitai

coderabbitai Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The install.sh script was enhanced to improve Ollama installation handling. A new platform-specific installation function was added that leverages Homebrew on macOS and curl on other systems. GPU detection logic was extended to recognize Apple Silicon as a valid GPU platform. Installation calls were refactored to centralize platform-specific logic.

Changes

Cohort / File(s) Summary
Ollama Installation Enhancement
install.sh
Added install_ollama_platform() function for platform-specific installation. Enhanced detect_gpu() to explicitly recognize Apple Silicon (Darwin arm64). Consolidated Ollama installation logic during version upgrades and fresh installations. Added early return in no-GPU path to prevent unnecessary installation attempts.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A platform for every hare,
Apple Silicon with utmost care,
Ollama now picks the rightful way,
Homebrew on Mac, or curl's display,
Installation cleaner, logic so fair! 🍎

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main changes: Apple Silicon GPU detection and Homebrew-based Ollama installation on macOS, which directly align with the PR's core objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
install.sh (1)

162-163: Simplify to idiomatic Homebrew pattern.

brew install ollama is Homebrew's standard way to install or upgrade a formula—it automatically upgrades if already installed (unless HOMEBREW_NO_INSTALL_UPGRADE is set), and returns exit code 0 even when already installed. The fallback || brew upgrade ollama only triggers on actual errors (network/download failures), which would fail identically on upgrade, making it ineffective. Simply use brew 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).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7cd8655e-fc3c-4784-b2c9-f630e81792ef

📥 Commits

Reviewing files that changed from the base of the PR and between 1e23347 and 26dfba0.

📒 Files selected for processing (1)
  • install.sh

@wscurran wscurran added platform: macos Affects macOS, including Apple Silicon Local Models labels Mar 18, 2026
mafueee pushed a commit to mafueee/NemoClaw that referenced this pull request Mar 28, 2026
@wscurran

Copy link
Copy Markdown
Contributor

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 install.sh — Ollama on macOS is now managed separately via an authenticated proxy (ollama-auth-proxy). The Apple Silicon detection and Homebrew install path here are no longer applicable.

Closing as superseded by the installer refactor. If you're hitting Ollama setup issues on Apple Silicon, the current path is documented in docs/inference/use-local-inference.md. Feel free to reopen if you find a gap.

@wscurran wscurran closed this Apr 21, 2026
@wscurran wscurran added area: local-models Local model providers, downloads, launch, or connectivity area: providers Inference provider integrations and provider behavior bug-fix PR fixes a bug or regression and removed priority: medium labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: local-models Local model providers, downloads, launch, or connectivity area: providers Inference provider integrations and provider behavior bug-fix PR fixes a bug or regression platform: macos Affects macOS, including Apple Silicon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants