Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: Apple Intelligence crash on macOS < 26 — weak-link in binary build.rs

Louis Beaumontb05765a7b840
diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.yml
index 6510571a4..905fdb385 100644
--- a/.github/workflows/release-app.yml
+++ b/.github/workflows/release-app.yml
@@ -142,11 +142,23 @@ jobs:
id: detect-xcode
shell: bash
run: |
- # TEMPORARILY DISABLED: Apple Intelligence crashes on macOS < 26 despite weak-linking
- # The FoundationModels.framework causes issues even with runtime guards.
- # Re-enable when we have a proper solution for older macOS versions.
- echo "has_apple_intelligence=false" >> $GITHUB_OUTPUT
- echo "⚠️ Apple Intelligence feature temporarily disabled in CI/CD to prevent crashes on older macOS"
+ # Re-enabled: weak-linking fix in binary crate build.rs ensures
+ # FoundationModels.framework is LC_LOAD_WEAK_DYLIB (not LC_LOAD_DYLIB).
+ # DYLD skips the framework on macOS < 26 instead of crashing.
+ # Runtime guard (is_macos_26_or_later) prevents any FFI calls.
+ # Tested: binary built on macOS 26 SDK runs on macOS 15.5 without crash.
+ SDK_PATH=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null || echo "")
+ SDK_SETTINGS="${SDK_PATH}/SDKSettings.json"
+ if [ -f "$SDK_SETTINGS" ] && grep -q '"26\.' "$SDK_SETTINGS"; then
+ echo "has_apple_intelligence=true" >> $GITHUB_OUTPUT
+ echo "🧠 macOS 26+ SDK detected — Apple Intelligence enabled"
+ elif [ -d "${SDK_PATH}/System/Library/Frameworks/FoundationModels.framework" ]; then
+ echo "has_apple_intelligence=true" >> $GITHUB_OUTPUT
+ echo "🧠 FoundationModels.framework found — Apple Intelligence enabled"
+ else
+ echo "has_apple_intelligence=false" >> $GITHUB_OUTPUT
+ echo "ℹ️ macOS SDK < 26 — Apple Intelligence not available (stub will be used)"
+ fi
- name: Enable Git long paths on Windows
if: matrix.os_type == 'windows'
diff --git a/Cargo.lock b/Cargo.lock
index 080f3c5ec..0cd5c9a29 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6641,7 +6641,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.131"
+version = "0.3.132"
dependencies = [
"anyhow",
"bytemuck",
@@ -6694,7 +6694,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.131"
+version = "0.3.132"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -6745,7 +6745,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.131"
+version = "0.3.132"
dependencies = [
"anyhow",
"chrono",
@@ -6769,7 +6769,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.131"
+version = "0.3.132"
dependencies = [
"anyhow",
"chrono",
@@ -6787,7 +6787,7 @@ dependencies = [
[[package]]
name = "screenpipe-integrations"
-version = "0.3.131"
+version = "0.3.132"
dependencies = [
"anyhow",
"image",
@@ -6802,7 +6802,7 @@ dependencies = [
[[package]]
name = "screenpipe-server"
-version = "0.3.131"
+version = "0.3.132"
dependencies = [
"anyhow",
"async-trait",
@@ -6873,7 +6873,7 @@ dependencies = [
[[package]]
name = "screenpipe-vision"
-version = "0.3.131"
+version = "0.3.132"
dependencies = [
"accessibility-sys",
"anyhow",
diff --git a/apps/screenpipe-app-tauri/src-tauri/build.rs b/apps/screenpipe-app-tauri/src-tauri/build.rs
index da3bb9552..fe097977f 100644
--- a/apps/screenpipe-app-tauri/src-tauri/build.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/build.rs
@@ -3,6 +3,15 @@ fn main() {
{
println!("cargo:rustc-link-lib=framework=AVFoundation");
+ // Weak-link FoundationModels so the app launches on macOS < 26.
+ // The Swift static library (from screenpipe-apple-intelligence) creates a strong
+ // LC_LOAD_DYLIB reference to FoundationModels.framework. Passing -weak_framework
+ // here in the *binary* crate's build.rs overrides it to LC_LOAD_WEAK_DYLIB,
+ // so DYLD skips the framework instead of crashing when it doesn't exist.
+ // Note: cargo:rustc-link-arg in a *library* crate's build.rs does NOT propagate
+ // to the final binary — it must be set here.
+ println!("cargo:rustc-link-arg=-Wl,-weak_framework,FoundationModels");
+
// Swift runtime rpaths — needed for apple-intelligence feature
// (libswift_Concurrency.dylib etc. live in these directories)
println!("cargo:rustc-link-arg=-Wl,-rpath,/usr/lib/swift");
diff --git a/crates/screenpipe-server/build.rs b/crates/screenpipe-server/build.rs
index b58f54528..ddff6929a 100644
--- a/crates/screenpipe-server/build.rs
+++ b/crates/screenpipe-server/build.rs
@@ -8,4 +8,12 @@ fn main() {
{
link_onnx();
}
+
+ #[cfg(target_os = "macos")]
+ {
+ // Weak-link FoundationModels so the CLI launches on macOS < 26.
+ // See apps/screenpipe-app-tauri/src-tauri/build.rs for detailed explanation.
+ println!("cargo:rustc-link-arg=-Wl,-weak_framework,FoundationModels");
+ println!("cargo:rustc-link-arg=-Wl,-rpath,/usr/lib/swift");
+ }
}