Skip to content

Commit 0bfc97f

Browse files
fix(build): sign all Mach-O binaries inside non-standard framework bundles (#1254)
PyInstaller copies Python.framework contents as separate files rather than symlinks, so Python, Versions/Current/Python, and Versions/3.9/Python are distinct inodes. The previous fallback only signed the single $fw_name binary, leaving the Versions/ copies unsigned — causing Apple notarization to reject all three affected watcher bundles (~6 errors per watcher, ~18 total). Replace the single-binary fallback with a loop that finds all Mach-O files inside the framework via `find -type f | xargs file | grep Mach-O` and signs each via a temp-path copy (avoids the in-place "bundle format is ambiguous" error from codesign when the parent dir is a .framework). This fix was validated in CI on the #1252 PR branch (3e635e4): all platforms passed including both macOS Build Tauri jobs with notarization succeeding.
1 parent c94ac70 commit 0bfc97f

1 file changed

Lines changed: 18 additions & 15 deletions

File tree

scripts/package/build_app_tauri.sh

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -153,25 +153,28 @@ if [ -n "$APPLE_PERSONALID" ]; then
153153
--sign "$APPLE_PERSONALID" \
154154
"$fw" 2>&1) && echo " Signed bundle: $fw" || {
155155
if echo "$sign_output" | grep -q "bundle format is ambiguous"; then
156-
echo " Note: $fw lacks standard bundle structure; signing main binary via temp copy"
157-
fw_name="$(basename "${fw%.*}")"
158-
fw_binary="$fw/$fw_name"
159-
if [ -f "$fw_binary" ]; then
160-
# codesign refuses to sign Python.framework/Python in-place because
161-
# it sees the parent .framework dir and reports "bundle format is
162-
# ambiguous". Copy to a temp path outside any bundle directory,
163-
# sign there, then copy back. Code signatures are embedded in the
164-
# binary (not path-dependent), so the result is identical.
156+
echo " Note: $fw lacks standard bundle structure; signing all Mach-O binaries inside via temp copy"
157+
# PyInstaller copies Python.framework contents as separate files rather
158+
# than symlinks — Python, Versions/Current/Python, and Versions/3.9/Python
159+
# are distinct inodes. Signing only $fw_name leaves the Versions/ copies
160+
# unsigned, causing Apple notarization to reject every affected watcher.
161+
# Sign every Mach-O file inside the framework via a temp-path copy to
162+
# avoid the in-place "bundle format is ambiguous" error from codesign.
163+
signed_count=0
164+
while IFS= read -r fw_bin; do
165+
echo " Signing framework binary via temp copy: $fw_bin"
165166
tmp_binary=$(mktemp)
166-
cp "$fw_binary" "$tmp_binary"
167-
sign_binary "$tmp_binary"
168-
cp "$tmp_binary" "$fw_binary"
167+
cp "$fw_bin" "$tmp_binary"
168+
sign_binary "$tmp_binary" || { rm -f "$tmp_binary"; exit 1; }
169+
cp "$tmp_binary" "$fw_bin"
169170
rm -f "$tmp_binary"
170-
else
171-
echo "ERROR: Expected main binary not found at $fw_binary" >&2
172-
echo " PyInstaller may have changed its output structure. Inspect $fw" >&2
171+
signed_count=$((signed_count + 1))
172+
done < <(find "$fw" -type f | xargs file | grep "Mach-O" | cut -d: -f1)
173+
if [ "$signed_count" -eq 0 ]; then
174+
echo "ERROR: No Mach-O binaries found inside $fw" >&2
173175
exit 1
174176
fi
177+
echo " Signed $signed_count Mach-O binary/binaries inside $fw"
175178
else
176179
echo "ERROR: Failed to sign $fw: $sign_output" >&2
177180
exit 1

0 commit comments

Comments
 (0)