Skip to content

fix(macos): Handle @rpath references in dylib bundling script - #468

Open
dodidev wants to merge 1 commit into
feschber:mainfrom
dodidev:main
Open

fix(macos): Handle @rpath references in dylib bundling script#468
dodidev wants to merge 1 commit into
feschber:mainfrom
dodidev:main

Conversation

@dodidev

@dodidev dodidev commented Jul 16, 2026

Copy link
Copy Markdown

Summary

Fix macOS runtime crash caused by missing transitive @rpath dependencies.

The copy-macos-dylib.sh script previously only copied dynamic libraries with absolute Homebrew paths. This caused runtime crashes (e.g., dyld: library not loaded) because it missed transitive dependencies that rely on relative @rpath references—such as libwebp.7.dylib failing to load libsharpyuv.0.dylib.

This PR enhances the dependency resolution inside scripts/copy-macos-dylib.sh to recursively discover, copy, and link both absolute and @rpath Homebrew libraries.

Key Changes

  • Dynamic @rpath Extraction: Uses otool -L to scan binaries and discover all nested @rpath dependencies.
  • Recursive Dependency Resolution: Locates the missing @rpath libraries within Homebrew, copies them to the app bundle, and updates their install names.
  • Error Prevention: Emits clear warnings if an @rpath library cannot be found in the expected Homebrew path to simplify troubleshooting.

Evidence / Error Log

dyld[17093]: library not loaded: @rpath/libsharpyuv.0.dylib
  referenced from: <d5d18de0-5439-3b6e-8118-b5d7b486ec66> /applications/lan mouse.app/contents/frameworks/libwebp.7.dylib
  reason: tried: 
    '/applications/lan mouse.app/contents/frameworks/../lib/libsharpyuv.0.dylib' (no such file), 
    '/applications/lan mouse.app/contents/frameworks/libsharpyuv.0.dylib' (no such file), 
    '/applications/lan mouse.app/contents/frameworks/libsharpyuv.0.dylib' (no such file)
zsh: abort      /applications/lan\ mouse.app/contents/macos/lan-mouse

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.

1 participant