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

ci(macos-intel): bundle x86_64 ONNX Runtime dylib so Intel builds run

Louis Beaumont263f69def02e
diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.yml
index be6adbf2e..68877b617 100644
--- a/.github/workflows/release-app.yml
+++ b/.github/workflows/release-app.yml
@@ -1200,6 +1200,109 @@ jobs:
codesign --verify --verbose=2 "$DMG"
echo "✅ ${DMG##*/} re-created + signed from patched .app (with Applications symlink)"
+ - name: Inject libonnxruntime.dylib into Contents/MacOS/ + re-sign (Intel macOS)
+ # ort rc.12 ships no x86_64-apple-darwin prebuilt (pyke + upstream ONNX
+ # Runtime are arm64-only since ~1.20), so the Intel build links ONNX
+ # Runtime via `load-dynamic` and loads libonnxruntime.dylib at runtime.
+ # ort's loader resolves the bare "libonnxruntime.dylib" relative to the
+ # executable dir (Contents/MacOS/), so the dylib must sit next to the
+ # binary — same constraint, and same inject + re-sign + rebuild-DMG
+ # flow, as the mlx.metallib step above. Must run BEFORE notarization.
+ #
+ # Source: the Homebrew onnxruntime bottle (x86_64, 1.26.0), pinned by
+ # immutable ghcr blob digest (QQ== is Homebrew's anonymous ghcr token).
+ # ort only warns (never errors) when the dylib is newer than its target
+ # 1.24, so the 1.26 build is accepted.
+ if: matrix.target == 'x86_64-apple-darwin'
+ shell: bash
+ env:
+ APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
+ run: |
+ set -euo pipefail
+ TARGET="${{ matrix.target }}"
+ BUNDLE_DIR="apps/screenpipe-app-tauri/src-tauri/target/${TARGET}/release/bundle"
+ APP_DIR="${BUNDLE_DIR}/macos"
+
+ shopt -s nullglob
+ apps=( "${APP_DIR}"/*.app )
+ if [ ${#apps[@]} -eq 0 ]; then
+ echo "no .app to patch — skipping libonnxruntime inject"
+ exit 0
+ fi
+ APP="${apps[0]}"
+
+ # Fetch the x86_64 ONNX Runtime dylib from the Homebrew bottle
+ # (content-addressed = immutable; won't move if the formula bumps).
+ ORT_BLOB="https://ghcr.io/v2/homebrew/core/onnxruntime/blobs/sha256:afe69511a14f1b9351074b0bf9e5de65858d25a6795ab7f228ba78b149079c3d"
+ TMP="${RUNNER_TEMP:-/tmp}/ort-x64-$$"
+ mkdir -p "$TMP"
+ echo "=== Downloading x86_64 libonnxruntime.dylib (Homebrew bottle) ==="
+ curl -fsSL -H "Authorization: Bearer QQ==" "$ORT_BLOB" -o "$TMP/bottle.tar.gz"
+ tar -xzf "$TMP/bottle.tar.gz" -C "$TMP"
+ SRC_DYLIB="$(find "$TMP" -name 'libonnxruntime*.dylib' | head -1)"
+ if [ -z "$SRC_DYLIB" ]; then
+ echo "ERROR: no libonnxruntime dylib found in bottle" >&2
+ exit 1
+ fi
+ if ! lipo -info "$SRC_DYLIB" | grep -q 'x86_64'; then
+ echo "ERROR: dylib is not x86_64: $(lipo -info "$SRC_DYLIB")" >&2
+ exit 1
+ fi
+ DEST="${APP}/Contents/MacOS/libonnxruntime.dylib"
+ echo "=== Injecting $(basename "$SRC_DYLIB") -> Contents/MacOS/libonnxruntime.dylib ==="
+ cp "$SRC_DYLIB" "$DEST"
+ chmod 0644 "$DEST"
+
+ # Re-unlock the keychain before re-signing — same retry pattern the
+ # build + metallib steps use, since codesign needs the cert.
+ BUILD_KC="$HOME/Library/Keychains/build.keychain-db"
+ if [ -f "$BUILD_KC" ]; then
+ security unlock-keychain -p "build_password" "$BUILD_KC"
+ security set-keychain-settings -t 3600 "$BUILD_KC"
+ fi
+
+ # Sign the injected dylib (hardened runtime + timestamp, required for
+ # notarization), then re-sign the whole bundle so the cdhash covers it.
+ codesign --force --sign "$APPLE_SIGNING_IDENTITY" --options runtime --timestamp "$DEST"
+ codesign --force --deep \
+ --sign "$APPLE_SIGNING_IDENTITY" \
+ --options runtime \
+ --entitlements apps/screenpipe-app-tauri/src-tauri/entitlements.plist \
+ --timestamp \
+ "$APP"
+ codesign --verify --deep --strict --verbose=2 "$APP"
+ echo "✅ ${APP##*/} re-signed with libonnxruntime.dylib in Contents/MacOS/"
+
+ # Rebuild the DMG so it ships the patched .app (same cheaper
+ # delete + recreate-from-staging flow as the metallib step, with the
+ # Applications symlink so drag-to-install still works).
+ DMG_DIR="${BUNDLE_DIR}/dmg"
+ dmgs=( "${DMG_DIR}"/*.dmg )
+ if [ ${#dmgs[@]} -eq 0 ]; then
+ echo "no DMG produced — skipping DMG patch"
+ rm -rf "$TMP"
+ exit 0
+ fi
+ DMG="${dmgs[0]}"
+ echo "=== Replacing DMG: ${DMG##*/} ==="
+ df -h "$DMG_DIR" | tail -1
+ rm -f "$DMG"
+ DMG_STAGE="${RUNNER_TEMP:-/tmp}/screenpipe-dmg-stage-$$"
+ mkdir -p "$DMG_STAGE"
+ cp -R "$APP" "$DMG_STAGE/"
+ ln -s /Applications "$DMG_STAGE/Applications"
+ hdiutil create \
+ -volname "Screenpipe" \
+ -srcfolder "$DMG_STAGE" \
+ -ov \
+ -format UDZO \
+ -imagekey zlib-level=9 \
+ "$DMG"
+ rm -rf "$DMG_STAGE" "$TMP"
+ codesign --force --sign "$APPLE_SIGNING_IDENTITY" --timestamp "$DMG"
+ codesign --verify --verbose=2 "$DMG"
+ echo "✅ ${DMG##*/} re-created + signed from patched .app (with libonnxruntime.dylib)"
+
- name: Clean up signing cert from login keychain (macOS)
if: matrix.os_type == 'macos' && always()
shell: bash
diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml
index 867441d4c..d0a49b235 100644
--- a/.github/workflows/release-cli.yml
+++ b/.github/workflows/release-cli.yml
@@ -216,6 +216,23 @@ jobs:
|| echo "⚠️ Failed to download mlx.metallib"
fi
+ # Bundle the x86_64 ONNX Runtime dylib next to the CLI binary. Intel
+ # mac uses load-dynamic (no rc.12 prebuilt); ort loads it from next to
+ # the executable at runtime. Signed so the hardened-runtime binary can
+ # load it (library validation). Homebrew bottle, immutable ghcr blob.
+ if [[ "${{ matrix.target }}" == "x86_64-apple-darwin" ]]; then
+ ORT_BLOB="https://ghcr.io/v2/homebrew/core/onnxruntime/blobs/sha256:afe69511a14f1b9351074b0bf9e5de65858d25a6795ab7f228ba78b149079c3d"
+ ORT_TMP="${RUNNER_TEMP:-/tmp}/ort-cli-$$"
+ mkdir -p "$ORT_TMP"
+ curl -fsSL -H "Authorization: Bearer QQ==" "$ORT_BLOB" -o "$ORT_TMP/bottle.tar.gz"
+ tar -xzf "$ORT_TMP/bottle.tar.gz" -C "$ORT_TMP"
+ ORT_DYLIB="$(find "$ORT_TMP" -name 'libonnxruntime*.dylib' | head -1)"
+ cp "$ORT_DYLIB" screenpipe-${{ env.VERSION }}-${{ matrix.target }}/bin/libonnxruntime.dylib
+ codesign --force --options runtime --sign "${{ secrets.APPLE_SIGNING_IDENTITY }}" --timestamp screenpipe-${{ env.VERSION }}-${{ matrix.target }}/bin/libonnxruntime.dylib
+ rm -rf "$ORT_TMP"
+ echo "✅ Bundled + signed libonnxruntime.dylib for Intel CLI"
+ fi
+
tar -czf screenpipe-${{ env.VERSION }}-${{ matrix.target }}.tar.gz -C screenpipe-${{ env.VERSION }}-${{ matrix.target }} .
- name: Calculate SHA256
@@ -630,7 +647,7 @@ jobs:
# macOS x64
mkdir -p packages/cli/screenpipe-darwin-x64/bin
- cd artifacts/screenpipe-macos-x86_64-apple-darwin && tar -xzf screenpipe-*.tar.gz && cp bin/screenpipe ../../packages/cli/screenpipe-darwin-x64/bin/ && cd ../..
+ cd artifacts/screenpipe-macos-x86_64-apple-darwin && tar -xzf screenpipe-*.tar.gz && cp bin/screenpipe ../../packages/cli/screenpipe-darwin-x64/bin/ && (cp bin/libonnxruntime.dylib ../../packages/cli/screenpipe-darwin-x64/bin/ 2>/dev/null || true) && cd ../..
chmod +x packages/cli/screenpipe-darwin-x64/bin/screenpipe
# Linux x64