Skip to content

fix(services): disable macOS ollama agent and fix local-binaries linker - #1279

Merged
shunkakinoki merged 1 commit into
mainfrom
fix/services-ollama-and-local-binaries
Mar 25, 2026
Merged

fix(services): disable macOS ollama agent and fix local-binaries linker#1279
shunkakinoki merged 1 commit into
mainfrom
fix/services-ollama-and-local-binaries

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Mar 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Remove launchd ollama agent on macOS — native Ollama.app already binds :11434, causing perpetual "address already in use" errors in /tmp/ollama.error.log
  • Export LIBRARY_PATH in update-local-binaries.sh to point to the actual Xcode clang runtime dir, fixing Rust crate builds that hard-code an older clang lib search path (e.g. clang 17 vs installed clang 21)

Test plan

  • make shell-test — 253 tests, 892 examples, 0 failures
  • Verified coding_agent_session_search builds successfully with the LIBRARY_PATH fix
  • Verified native Ollama.app continues serving on :11434 after removing the home-manager agent

🤖 Generated with Claude Code


Summary by cubic

Disable the Ollama launchd agent on macOS to prevent :11434 conflicts with Ollama.app. Export the Xcode clang runtime path in update-local-binaries.sh so Rust crates link clang_rt correctly on macOS.

  • Bug Fixes
    • macOS: skip the Ollama launchd agent; keep the Linux systemd user service.
    • macOS: in update-local-binaries.sh, export LIBRARY_PATH to the Xcode clang lib/darwin dir when present, fixing clang_rt linking errors.

Written for commit 089814e. Summary will update on new commits.

Copilot AI review requested due to automatic review settings March 25, 2026 21:45
@mesa-dot-dev

mesa-dot-dev Bot commented Mar 25, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@coderabbitai

coderabbitai Bot commented Mar 25, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7a1b841b-5d28-4e7c-8d79-1eb701fdb87d

📥 Commits

Reviewing files that changed from the base of the PR and between 4cd8f53 and 089814e.

📒 Files selected for processing (1)
  • scripts/update-local-binaries.sh

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Improved build environment configuration for macOS systems to optimize library path resolution during the build process.

Walkthrough

The scripts/update-local-binaries.sh script now includes logic to locate the Xcode default toolchain's clang Darwin runtime library directory on macOS and prepends it to the LIBRARY_PATH environment variable before subsequent build steps execute.

Changes

Cohort / File(s) Summary
Xcode Library Path Configuration
scripts/update-local-binaries.sh
Added macOS-specific logic to detect and prepend Xcode clang runtime library path (/Applications/Xcode.app/.../lib/clang/*/lib/darwin) to LIBRARY_PATH early in script execution.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Suggested labels

bug

Poem

🐰 A Darwin path was lost in the dark,
But our script now finds Xcode's spark,
With LIBRARY_PATH set just right,
The clang runtime shines so bright! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: disabling macOS ollama agent and fixing local-binaries linker issues.
Description check ✅ Passed The description clearly explains the rationale, changes, and test plan, all directly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/services-ollama-and-local-binaries

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses two distinct but critical macOS-specific issues impacting development environment stability and build processes. It resolves a port conflict with the Ollama service by disabling a redundant launchd agent and fixes Rust compilation errors by ensuring the linker correctly locates the Xcode clang runtime libraries.

Highlights

  • macOS Ollama Agent Disabled: The launchd agent for Ollama on macOS has been disabled to prevent "address already in use" errors, as the native Ollama.app already binds to port 11434. The agent will now only be enabled on Linux.
  • Local Binaries Linker Fix: The update-local-binaries.sh script was updated to export LIBRARY_PATH on macOS, pointing to the Xcode clang runtime directory. This resolves Rust crate build failures caused by hard-coded older clang library search paths.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mesa-dot-dev

mesa-dot-dev Bot commented Mar 25, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Disabled the Ollama launchd agent on macOS to prevent port conflicts and fixed Rust crate linking issues on macOS by exporting the Xcode clang runtime path in update-local-binaries.sh.

What changed?

  • home-manager/services/ollama/default.nix: The Ollama service is now explicitly disabled on macOS by removing the launchd agent, preventing port conflicts with the native Ollama.app. It is now only enabled for Linux systems via systemd.
  • scripts/update-local-binaries.sh: Modified to configure the LIBRARY_PATH environment variable specifically for macOS, dynamically locating and adding the clang_rt library path from the Xcode toolchain to resolve linker issues with Rust crates.

Description generated by Mesa. Update settings

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request removes the macOS launchd agent for the Ollama service to prevent port conflicts with the native application, ensuring it's only enabled on Linux via systemd. Additionally, it introduces logic to scripts/update-local-binaries.sh to set the LIBRARY_PATH on macOS, aiming to help the linker find clang_rt libraries for Rust builds. A review comment highlights robustness issues in this new macOS logic, specifically regarding a hardcoded Xcode path and unsafe glob expansion, and provides a more resilient implementation suggestion.

Comment on lines +10 to +13
CLANG_LIB="$(echo /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/*/lib/darwin)"
if [ -d "$CLANG_LIB" ]; then
export LIBRARY_PATH="${CLANG_LIB}${LIBRARY_PATH:+:$LIBRARY_PATH}"
fi

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.

high

This implementation has a couple of robustness issues:

  1. Hardcoded Xcode Path: The path /Applications/Xcode.app is hardcoded. It's better to use xcode-select -p to find the developer directory dynamically, as Xcode can be installed in other locations.
  2. Unsafe Glob Expansion: The command echo ...*... is not safe. If the * glob expands to multiple directories (e.g., multiple clang versions installed), $CLANG_LIB will contain a space-separated string of paths, and the if [ -d "$CLANG_LIB" ] test will fail with a "too many arguments" error.

Here is a more robust implementation that addresses both points by using xcode-select and handling glob expansion with an array.

Suggested change
CLANG_LIB="$(echo /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/*/lib/darwin)"
if [ -d "$CLANG_LIB" ]; then
export LIBRARY_PATH="${CLANG_LIB}${LIBRARY_PATH:+:$LIBRARY_PATH}"
fi
XCODE_DEV_PATH="$(xcode-select -p 2>/dev/null)"
if [ -n "$XCODE_DEV_PATH" ]; then
# Use an array to safely handle glob expansion and take the first result.
CLANG_LIB_PATHS=("$XCODE_DEV_PATH"/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/*/lib/darwin)
if [[ ${#CLANG_LIB_PATHS[@]} -gt 0 && -d "${CLANG_LIB_PATHS[0]}" ]]; then
export LIBRARY_PATH="${CLANG_LIB_PATHS[0]}${LIBRARY_PATH:+:$LIBRARY_PATH}"
fi
fi

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/update-local-binaries.sh">

<violation number="1" location="scripts/update-local-binaries.sh:10">
P2: Avoid hard-coding `/Applications/Xcode.app`; resolve the active developer directory dynamically so the linker path fix works across macOS setups.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread scripts/update-local-binaries.sh
Export LIBRARY_PATH in update-local-binaries.sh to point to the actual
Xcode clang runtime dir, fixing Rust crate builds that hard-code an
older clang lib search path (e.g. clang 17 vs installed clang 21).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 06e8f9690147
@shunkakinoki
shunkakinoki force-pushed the fix/services-ollama-and-local-binaries branch from 4cd8f53 to 089814e Compare March 25, 2026 21:48
@shunkakinoki
shunkakinoki merged commit 749a5b0 into main Mar 25, 2026
8 checks passed
@shunkakinoki
shunkakinoki deleted the fix/services-ollama-and-local-binaries branch March 25, 2026 21:48

Copilot AI 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.

Pull request overview

This PR addresses two macOS-related developer-environment issues in the repo’s Home Manager services and local build tooling: avoiding a conflicting Ollama launchd agent on macOS, and improving Rust/macOS linking reliability by pointing the linker at Xcode’s clang_rt runtime directory.

Changes:

  • Add a macOS-only LIBRARY_PATH export in scripts/update-local-binaries.sh to help the linker find clang_rt.
  • Remove the macOS launchd Ollama agent and keep the Ollama service enabled only on Linux via systemd.user.services.

Reviewed changes

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

File Description
scripts/update-local-binaries.sh Exports LIBRARY_PATH on Darwin to include Xcode clang_rt runtime directory for linker compatibility.
home-manager/services/ollama/default.nix Drops macOS launchd agent configuration; retains Linux-only systemd user service.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +10 to +11
CLANG_LIB="$(echo /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/*/lib/darwin)"
if [ -d "$CLANG_LIB" ]; then

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

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

CLANG_LIB is derived via echo .../clang/*/lib/darwin, which can expand to multiple paths (space-separated) if more than one clang version directory exists; in that case [ -d "$CLANG_LIB" ] will fail and LIBRARY_PATH won’t be set. Consider resolving a single directory deterministically (e.g., using xcode-select -p plus ls -d ... | sort -V | tail -n1, or a small find/array-glob) and avoiding echo for glob expansion.

Suggested change
CLANG_LIB="$(echo /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/*/lib/darwin)"
if [ -d "$CLANG_LIB" ]; then
# Use the active Xcode toolchain and pick the highest clang version's darwin lib dir.
XCODE_PATH="$(xcode-select -p 2>/dev/null || true)"
if [ -n "$XCODE_PATH" ]; then
CLANG_LIB="$(ls -d "$XCODE_PATH"/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/*/lib/darwin 2>/dev/null | sort -V | tail -n 1 || true)"
else
CLANG_LIB=""
fi
if [ -n "${CLANG_LIB:-}" ] && [ -d "$CLANG_LIB" ]; then

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants