#!/bin/sh set -eu homebrew_path="" exec_path="target/debug/bundle/osx/Lan Mouse.app/Contents/MacOS/lan-mouse" usage() { cat < $dest" cp -f "$old_path" "$dest" # Ensure the copied dylib is writable so that xattr -rd /path/to/Lan\ Mouse.app works. chmod 644 "$dest" echo "Updating $dest to have install_name of @rpath/$base_name..." install_name_tool -id "@rpath/$base_name" "$dest" # Recursively process this dylib fix_references "$dest" fi echo "Updating $bin to reference @rpath/$base_name..." install_name_tool -change "$old_path" "@rpath/$base_name" "$bin" done } fix_references "$exec_path" # Ensure the main executable has our Frameworks path in its RPATH if ! otool -l "$exec_path" | grep -q "@executable_path/../Frameworks"; then echo "Adding RPATH to $exec_path" install_name_tool -add_rpath "@executable_path/../Frameworks" "$exec_path" fi # Se-sign the .app codesign --force --deep --sign - "$bundle_path" echo "Done!"