Skip to content

feat: add setup-apple command for Apple Silicon Macs#285

Open
chhotu2601 wants to merge 3 commits intoNVIDIA:mainfrom
chhotu2601:feat/setup-apple
Open

feat: add setup-apple command for Apple Silicon Macs#285
chhotu2601 wants to merge 3 commits intoNVIDIA:mainfrom
chhotu2601:feat/setup-apple

Conversation

@chhotu2601
Copy link

@chhotu2601 chhotu2601 commented Mar 18, 2026

Summary

Adds a nemoclaw setup-apple command (analogous to setup-spark for DGX Spark) that validates and configures Apple Silicon Mac environments for NemoClaw.

What it does

  1. Validates environment — confirms macOS + Apple Silicon, reports GPU cores and unified memory
  2. Checks Docker Desktop — finds socket (Docker Desktop, Colima, or Podman), validates daemon is running
  3. Configures Ollama — installs via Homebrew if missing, starts service, suggests models if none present
  4. Validates OpenShell — checks CLI is available
  5. Prints summary — clean table of environment status + next steps + known limitations

Why

macOS/Apple Silicon is a major developer platform, but NemoClaw only has setup-spark for DGX. This fills the gap for Mac users who need guidance on Docker Desktop + Ollama configuration.

References tracking issue #260.

Test plan

# On macOS Apple Silicon:
bash scripts/setup-apple.sh

# Verify CLI integration:
node bin/nemoclaw.js setup-apple
node bin/nemoclaw.js help  # should list setup-apple

Screenshot

N/A (CLI output only)


Co-authored-by: Yajat Singh yajatns@gmail.com
Addresses part of #260

Summary by CodeRabbit

  • New Features
    • Added a new setup-apple CLI command to streamline Apple Silicon Mac setup.
    • Performs automated pre-flight checks (macOS/arm64), Docker status discovery, and runtime validation.
    • Automates Ollama installation/startup and health checks, with guidance when models are missing.
    • Validates OpenShell CLI presence and shows a colored, user-friendly status summary with next steps.

Adds a 'nemoclaw setup-apple' command that validates and configures
macOS Apple Silicon environments:

- Validates macOS + arm64 architecture
- Checks Docker Desktop socket (Desktop, Colima, Podman)
- Installs and configures Ollama for local inference
- Reports GPU cores and unified memory
- Validates OpenShell CLI availability
- Prints clear next steps and known limitations

Closes part of NVIDIA#260 (macOS support tracking)

Co-authored-by: Yajat Singh <yajatns@gmail.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7272eda0-4918-46e5-a210-1e3476e73881

📥 Commits

Reviewing files that changed from the base of the PR and between 1b9eb87 and 3792781.

📒 Files selected for processing (1)
  • scripts/setup-apple.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/setup-apple.sh

📝 Walkthrough

Walkthrough

Adds a new "setup-apple" CLI command and a corresponding Bash script to detect and configure Apple Silicon macOS environments (checks macOS/arm64, Docker availability, Ollama installation/startup, OpenShell presence, and prints a final status and next steps).

Changes

Cohort / File(s) Summary
CLI Command
bin/nemoclaw.js
Register new setup-apple command, dispatch to setupApple() handler, and update help text to include "nemoclaw setup-apple".
Apple Silicon Setup Script
scripts/setup-apple.sh
Add new script performing macOS/arm64 validation, Docker daemon/socket discovery and version reporting, Ollama installation/start and health checks (brew and direct serve fallbacks), model presence guidance, OpenShell CLI validation, and a final formatted status/next-steps summary.

Sequence Diagram

sequenceDiagram
    actor User
    participant CLI as "nemoclaw CLI"
    participant Handler as "setupApple Handler"
    participant Script as "scripts/setup-apple.sh"
    participant System as "System Components\n(macOS, Docker, Ollama, OpenShell)"

    User->>CLI: run `nemoclaw setup-apple`
    CLI->>Handler: dispatch setupApple()
    Handler->>Script: execute `scripts/setup-apple.sh`
    Script->>System: check macOS version & architecture
    System-->>Script: macOS/arch info
    Script->>System: locate/verify Docker daemon & socket
    System-->>Script: Docker reachable / version
    Script->>System: install/start Ollama (brew or serve)
    System-->>Script: Ollama API health / models list
    Script->>System: check OpenShell CLI presence
    System-->>Script: OpenShell status
    Script-->>User: display formatted status and next steps
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇 I hopped through shells and Docker steam,

On Apple silicon I found my dream.
Ollama warmed and models peeked,
OpenShell checked — no longer leaked.
Hop on, friend, your Mac's all sleek!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% 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 clearly and concisely describes the main change: adding a new CLI command for Apple Silicon Mac setup. It directly corresponds to the primary objective of the PR.

✏️ 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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/setup-apple.sh`:
- Around line 43-45: The script currently only warns when the ARCH variable is
not "arm64" or "aarch64" (the if block checking ARCH and calling warn), but this
setup is Apple-Silicon-specific and should fail fast; update that conditional to
stop execution on non-Apple-Silicon hosts by replacing the warn-only behavior
with a fatal exit (e.g., call the existing fatal/err handler or run exit 1) so
the script does not continue running Intel-specific systems — locate the if [
"$ARCH" != "arm64" ] && [ "$ARCH" != "aarch64" ] check and change it to
terminate with a non-zero status and a clear error message.
- Line 53: The GPU_CORES assignment pipeline can cause the script to exit under
set -euo pipefail if grep returns no match; update the command that sets
GPU_CORES so the pipeline cannot trigger pipefail (e.g., append a safe fallback
like "|| true" to the pipeline or wrap the pipeline in a construct that prevents
non-zero exit), then normalize/validate GPU_CORES afterwards (set a sensible
default like 0 or detect an alternate key) to ensure GPU_CORES is always
defined; target the GPU_CORES assignment line to implement these changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 06d1e9e8-fa3f-41cc-a7c4-3600cfae13e1

📥 Commits

Reviewing files that changed from the base of the PR and between 1e23347 and 28504e8.

📒 Files selected for processing (2)
  • bin/nemoclaw.js
  • scripts/setup-apple.sh

…a cleanup

- Intel Macs now fail with clear message instead of warning
- Replaced python3 JSON parsing with grep (macOS 12.3+ has no Python)
- Ollama startup prefers brew services (managed, survives reboots)
- Added cleanup trap for background Ollama process
- No orphaned processes on script failure/Ctrl-C
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
scripts/setup-apple.sh (1)

52-55: ⚠️ Potential issue | 🟠 Major

Make GPU metadata collection non-fatal.

Line 53 still runs grep inside a pipeline under set -euo pipefail, so localized or variant system_profiler output can abort the entire setup instead of just leaving GPU_CORES empty.

Suggested fix
-  GPU_CORES=$(system_profiler SPDisplaysDataType 2>/dev/null | grep "Total Number of Cores" | awk -F': ' '{print $2}' | head -1)
+  GPU_CORES=$(system_profiler SPDisplaysDataType 2>/dev/null | awk -F': ' '/Total Number of Cores/{print $2; exit}')
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/setup-apple.sh` around lines 52 - 55, The GPU metadata collection can
abort the script under set -euo pipefail because the pipeline (system_profiler |
grep | awk) can fail; change the GPU/ memory detection to be non-fatal by
running system_profiler into a temporary variable or file and then safely
grepping/awk’ing with fallbacks (e.g., capture output from `system_profiler
SPDisplaysDataType` into a var, then set GPU_CORES from that var using grep/awk
with `|| true` or conditional checks) and similarly compute UNIFIED_MEM using
`sysctl -n hw.memsize` but default to empty or zero if the command fails; update
the code paths that set GPU_CORES and UNIFIED_MEM (references: GPU_CORES,
UNIFIED_MEM, system_profiler, grep, awk, sysctl) so failures do not cause script
exit.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/setup-apple.sh`:
- Around line 129-139: The EXIT trap is killing the fallback Ollama background
process on normal script completion; update the trap logic so the background PID
stored in OLLAMA_BG_PID is only killed on interrupt signals, not on normal
exit—either remove EXIT from the trap and register it for INT and TERM only, or
introduce a boolean flag (e.g., OLLAMA_PRESERVE_ON_EXIT) set after confirming
Ollama started and change the trap handler to check that flag before killing
OLLAMA_BG_PID; adjust the trap declaration and use of OLLAMA_BG_PID and
OLLAMA_RUNNING accordingly so the process remains running after successful
script completion but is still cleaned up on interrupts.
- Around line 145-151: The MODEL_COUNT command substitution can produce
duplicate "0" lines because grep -co returns nonzero exit status and the || echo
fallback appends another "0", so update the MODEL_COUNT assignment to reliably
produce a single integer; for example, replace the current command that sets
MODEL_COUNT with a pipeline that counts matches robustly (e.g., use curl ... |
grep -o '"name"' | wc -l or use jq to count items) so the subsequent comparison
[ "$MODEL_COUNT" = "0" ] in the setup logic correctly detects an empty model
list; modify the assignment that defines MODEL_COUNT and keep the rest of the
conditional (info "No models found..." / info "Ollama has ${MODEL_COUNT}
model(s) available") unchanged.

---

Duplicate comments:
In `@scripts/setup-apple.sh`:
- Around line 52-55: The GPU metadata collection can abort the script under set
-euo pipefail because the pipeline (system_profiler | grep | awk) can fail;
change the GPU/ memory detection to be non-fatal by running system_profiler into
a temporary variable or file and then safely grepping/awk’ing with fallbacks
(e.g., capture output from `system_profiler SPDisplaysDataType` into a var, then
set GPU_CORES from that var using grep/awk with `|| true` or conditional checks)
and similarly compute UNIFIED_MEM using `sysctl -n hw.memsize` but default to
empty or zero if the command fails; update the code paths that set GPU_CORES and
UNIFIED_MEM (references: GPU_CORES, UNIFIED_MEM, system_profiler, grep, awk,
sysctl) so failures do not cause script exit.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: aac52eed-d44c-4572-b3fa-281c6bf221fd

📥 Commits

Reviewing files that changed from the base of the PR and between 28504e8 and 1b9eb87.

📒 Files selected for processing (1)
  • scripts/setup-apple.sh

@wscurran wscurran added the Platform: MacOS Support for MacOS label Mar 18, 2026
…fallback

- Comment 2: Add || true to GPU core detection pipeline to prevent pipefail abort on VMs/headless Macs
- Comment 3: Remove EXIT from trap — only kill Ollama on INT/TERM, not normal script completion
- Comment 4: Disable pipefail for MODEL_COUNT grep to handle empty JSON gracefully
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Platform: MacOS Support for MacOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants