#!/bin/bash # Sign release binaries with ad-hoc signature # Usage: ./scripts/sign_binaries.sh # # Why: macOS kills unsigned binaries with SIGKILL (exit code 137) # when copied from another machine. # # This script signs all binaries with ad-hoc signature ("-") # which is sufficient for local execution. set -e cd target/release echo "=== Signing release binaries ===" for B in momentry rust_register rust_unregister; do if [ -f "$B" ]; then echo "Signing $B..." codesign --force --sign - "$B" # Verify signature if codesign -dv "$B" 2>&1 | grep -q "Signature"; then echo "✓ $B signed successfully" else echo "✗ Failed to sign $B" exit 1 fi else echo "✗ Missing: $B" exit 1 fi done echo "" echo "=== All binaries signed ==="