A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.
Rust agentagent-orchestrationaiai-agentsclaude-codecodexcoding-agentlinuxmacosmultiplayermultiplexerrustterminalterminal-emulatorterminal-multiplexertmuxtuiweztermwindows
Sign and notarize macOS packages locally
RoversXbca28a813145
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex a65f1a7d..50cd6426 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -14,14 +14,17 @@ on:tags: ['v*']workflow_dispatch:inputs:+ # Off by default: this runner has no Developer ID certificate, so+ # ci/deploy.sh falls back to an ad-hoc signature that Gatekeeper refuses.+ # Release builds are produced locally with ci/macos-package.sh instead.macos_arm64:- description: macOS arm64+ description: macOS arm64 (no certificate here -- ad-hoc signed only)type: boolean- default: true+ default: falsemacos_x86_64:- description: macOS x86_64+ description: macOS x86_64 (no certificate here -- ad-hoc signed only)type: boolean- default: true+ default: falsewindows_x86_64:description: Windows x86_64type: boolean@@ -71,12 +74,18 @@ jobs:set -euo pipefailif [ "$GITHUB_EVENT_NAME" = 'push' ]; then- # A tag build is always the full matrix, published.+ # A tag build publishes everything CI can build correctly.release_tag="$GITHUB_REF_NAME"version="${GITHUB_REF_NAME#v}"publish=true- macos_arm64=true- macos_x86_64=true+ # macOS is signed, notarized and stapled locally by+ # ci/macos-package.sh, because the Developer ID certificate lives+ # in a keychain rather than in this repo's secrets. Building it+ # here would attach an ad-hoc signed zip that no other Mac can+ # open -- a broken download is worse than a missing one -- and+ # bill two jobs at the 10x macOS rate to do it.+ macos_arm64=false+ macos_x86_64=falsewindows=truelinux_x86_64=true# arm64 hosted runners are free on public repos only. Scheduling@@ -414,14 +423,20 @@ jobs:donels -l+ # The tag reaches these steps through env rather than a ${{ }} splice into+ # the script body. On a tag push it is GITHUB_REF_NAME verbatim, and git+ # accepts refs containing quotes and $(...) -- spliced inline, such a tag+ # would run as shell in a job holding contents: write and a token.- name: Create releaseenv:GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- run: bash ci/retry.sh bash ci/create-release.sh '${{ needs.prepare.outputs.release_tag }}'+ RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }}+ run: bash ci/retry.sh bash ci/create-release.sh "$RELEASE_TAG"- name: Upload to releaseenv:GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }}run: |bash ci/retry.sh gh release upload --clobber \- '${{ needs.prepare.outputs.release_tag }}' dist/*+ "$RELEASE_TAG" dist/*diff --git a/Cargo.lock b/Cargo.lockindex c1e94290..c2ffa65c 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -3339,9 +3339,9 @@ dependencies = [[[package]]name = "libgit2-sys"-version = "0.18.2+1.9.1"+version = "0.18.7+1.9.6"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1c42fe03df2bd3c53a3a9c7317ad91d80c81cd1fb0caec8d7cc4cd2bfa10c222"+checksum = "23c7391e4b9f4ffab1a624223cc1d7385ff9a678f490768add717de7ea2f4d89"dependencies = ["cc","libc",diff --git a/Cargo.toml b/Cargo.tomlindex 4aacb902..bbae94f9 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -113,7 +113,7 @@ futures-lite = "2.3"futures-util = "0.3"gethostname = "0.5"getrandom = "0.3.1"-git2 = { version = "0.20", default-features = false, features = ["https"] }+git2 = { version = "0.20", default-features = false, features = ["https", "vendored-libgit2"] }gl_generator = "0.14"glium = { version = "0.35", default-features = false }governor = {version="0.5", default-features=false, features=["std"]}diff --git a/ci/deploy.sh b/ci/deploy.shindex 1ae9f181..82f63901 100755--- a/ci/deploy.sh+++ b/ci/deploy.sh@@ -23,15 +23,18 @@ case $OSTYPE in# the name or the arm64 and x86_64 runs would overwrite each other's zip.# Unset means "whatever this machine produced", which is what a plain local# `cargo build --release` wants.- zipdir=ThinkTerm-macos${MACOS_ARCH:+-$MACOS_ARCH}-$TAG_NAME+ zipdir="ThinkTerm-macos${MACOS_ARCH:+-$MACOS_ARCH}-$TAG_NAME"if [[ "$BUILD_REASON" == "Schedule" ]] ; then- zipname=ThinkTerm-macos${MACOS_ARCH:+-$MACOS_ARCH}-nightly.zip+ zipname="ThinkTerm-macos${MACOS_ARCH:+-$MACOS_ARCH}-nightly.zip"else- zipname=$zipdir.zip+ zipname="$zipdir.zip"fi- rm -rf $zipdir $zipname- mkdir $zipdir- cp -r assets/macos/ThinkTerm.app $zipdir/+ # Quoted because $TAG_NAME reaches here from an interactive prompt in+ # ci/macos-package.sh. Unquoted, a tag of "v1 assets" would expand this+ # rm into two paths and delete assets/ from the repository root.+ rm -rf "$zipdir" "$zipname"+ mkdir "$zipdir"+ cp -r assets/macos/ThinkTerm.app "$zipdir/"# Omit MetalANGLE for now; it's a bit laggy compared to CGL,# and on M1/Big Sur, CGL is implemented in terms of Metal anywayrm $zipdir/ThinkTerm.app/*.dylib@@ -58,8 +61,14 @@ case $OSTYPE indoneset +x+ # Only a Developer ID signature is eligible for notarization; the notary+ # service rejects adhoc and Apple Development identities outright.+ notarize=noif [[ -n "${MACOS_SIGNING_MODE:-}" ]] ; thenbash ci/macos-sign-local.sh "$zipdir/ThinkTerm.app" "$MACOS_SIGNING_MODE"+ if [[ "$MACOS_SIGNING_MODE" == developerid ]] ; then+ notarize=yes+ fielif [ -n "$MACOS_TEAM_ID" ] ; thenMACOS_PW=$(echo $MACOS_CERT_PW | base64 --decode)echo "pw sha"@@ -91,6 +100,7 @@ case $OSTYPE insecurity default-keychain -d user -s $def_keychainecho "Remove build.keychain"security delete-keychain build.keychain || true+ notarize=yeselse# A normal local package should still be a correctly sealed app bundle.# Development/Developer ID identities remain opt-in, but ad-hoc signing@@ -98,17 +108,24 @@ case $OSTYPE inbash ci/macos-sign-local.sh "$zipdir/ThinkTerm.app" adhocfi- set -x- zip -r $zipname $zipdir- set +x-- if [[ -z "${MACOS_SIGNING_MODE:-}" && -n "$MACOS_TEAM_ID" ]] ; then- echo "Notarize"- xcrun notarytool submit $zipname --wait --team-id "$MACOS_TEAM_ID" --apple-id "$MACOS_APPLEID" --password "$MACOS_APP_PW"+ # Notarize and staple before packing, not after. Stapling rewrites the+ # bundle, so an archive built first would ship without the ticket and make+ # every first launch wait on a round trip to Apple's servers -- or fail+ # outright behind a firewall that blocks them.+ if [[ "$notarize" == yes ]] ; then+ bash ci/macos-notarize-local.sh "$zipdir/ThinkTerm.app"fi- set -x- SHA256=$(shasum -a 256 $zipname | cut -d' ' -f1)+ set -x+ # --sequesterRsrc is what makes this safe to hand to plain `unzip`. macOS+ # stamps com.apple.provenance on every file, so ditto emits an AppleDouble+ # ._ sidecar for each one; without sequestering they land inside the bundle+ # on extraction, and codesign then reports "a sealed resource is missing or+ # invalid" -- Finder calls that "damaged". Sequestering routes them to a+ # sibling __MACOSX/ that extractors ignore.+ /usr/bin/ditto -c -k --sequesterRsrc --keepParent "$zipdir" "$zipname"++ SHA256=$(shasum -a 256 "$zipname" | cut -d' ' -f1)sed -e "s/@TAG@/$TAG_NAME/g" -e "s/@SHA256@/$SHA256/g" < ci/wezterm-homebrew-macos.rb.template > wezterm.rb;;diff --git a/ci/macos-identity.sh b/ci/macos-identity.shnew file mode 100755index 00000000..b87785a3--- /dev/null+++ b/ci/macos-identity.sh@@ -0,0 +1,60 @@+#!/bin/bash++# Shared resolver for macOS signing identities. Meant to be sourced, not run.+#+# Auto-detection replaces what used to be a hardcoded team id. A hardcoded+# team only ever matches one developer's keychain, so a fresh clone would fail+# with a confusing "no certificate for team XXXX" even when the person running+# it has a perfectly good certificate of their own.++# resolve_signing_identity <kind>+#+# <kind> is the certificate prefix, e.g. "Developer ID Application" or+# "Apple Development". Echoes the full identity name on stdout when exactly+# one matches. Anything else is an error: zero means nothing to sign with,+# and more than one has no safe default, so both report to stderr and return 1+# rather than silently picking.+resolve_signing_identity() {+ local kind=$1+ local matches count++ if [[ -n "${MACOS_SIGNING_IDENTITY:-}" ]]; then+ printf '%s\n' "$MACOS_SIGNING_IDENTITY"+ return 0+ fi++ matches=$(+ security find-identity -v -p codesigning |+ sed -n "s/.*\"\(${kind}:[^\"]*\)\".*/\1/p"+ )+ count=$(grep -c . <<<"$matches" || true)++ case "$count" in+ 1)+ printf '%s\n' "$matches"+ return 0+ ;;+ 0)+ echo "No \"${kind}\" certificate found in your keychain." >&2+ echo "Create or download one at developer.apple.com > Certificates," >&2+ echo "or in Xcode > Settings > Accounts > Manage Certificates." >&2+ return 1+ ;;+ *)+ echo "More than one \"${kind}\" certificate in your keychain:" >&2+ sed 's/^/ /' <<<"$matches" >&2+ echo "There is no safe default, so pick one explicitly:" >&2+ echo " export MACOS_SIGNING_IDENTITY='<one full line from above>'" >&2+ return 1+ ;;+ esac+}++# team_id_from_identity <identity>+#+# Apple puts the team id in parentheses at the end of a Developer ID common+# name, which is the only place it can be read from without a second keychain+# query.+team_id_from_identity() {+ sed -n 's/.*(\([A-Z0-9]\{6,\}\))[[:space:]]*$/\1/p' <<<"$1"+}diff --git a/ci/macos-notarize-local.sh b/ci/macos-notarize-local.shnew file mode 100755index 00000000..e59dde4e--- /dev/null+++ b/ci/macos-notarize-local.sh@@ -0,0 +1,83 @@+#!/bin/bash++set -euo pipefail++APP_PATH=${1:?usage: macos-notarize-local.sh path/to/ThinkTerm.app [keychain-profile]}+PROFILE=${2:-${MACOS_NOTARY_PROFILE:-thinkterm}}++# Locally the credentials live in a keychain profile created once with+# `notarytool store-credentials`. A CI runner has no such keychain, so prefer+# the credentials passed in the environment whenever all three are present.+if [[ -n "${MACOS_APPLEID:-}" && -n "${MACOS_APP_PW:-}" && -n "${MACOS_TEAM_ID:-}" ]]; then+ NOTARY_AUTH=(--apple-id "$MACOS_APPLEID" --password "$MACOS_APP_PW" --team-id "$MACOS_TEAM_ID")+ echo "==> Using notarization credentials from the environment"+else+ NOTARY_AUTH=(--keychain-profile "$PROFILE")+ echo "==> Using notarization credentials from keychain profile '$PROFILE'"+fi++if [[ ! -d "$APP_PATH" ]]; then+ echo "App bundle not found: ${APP_PATH}" >&2+ exit 1+fi++# Notarization only accepts a container, never a bare .app, and it has to be+# built with ditto: plain `zip` drops the symlinks and extended attributes that+# codesign relies on, which Apple rejects as a damaged bundle.+WORK_DIR=$(mktemp -d)+trap 'rm -rf "$WORK_DIR"' EXIT+SUBMISSION_ZIP="$WORK_DIR/submission.zip"+RESULT_PLIST="$WORK_DIR/result.plist"++echo "==> Packing $APP_PATH for submission"+/usr/bin/ditto -c -k --keepParent "$APP_PATH" "$SUBMISSION_ZIP"++echo "==> Submitting to Apple (this usually takes 1-5 minutes)"+xcrun notarytool submit "$SUBMISSION_ZIP" \+ "${NOTARY_AUTH[@]}" \+ --wait \+ --output-format plist >"$RESULT_PLIST"++status=$(plutil -extract status raw -o - "$RESULT_PLIST")+submission_id=$(plutil -extract id raw -o - "$RESULT_PLIST")+echo "==> Submission $submission_id finished with status: $status"++if [[ "$status" != "Accepted" ]]; then+ # The submit output only says Invalid; the per-issue reasons live in the log,+ # which is the only thing that makes a rejection actionable.+ echo "==> Notarization failed, fetching the log" >&2+ xcrun notarytool log "$submission_id" "${NOTARY_AUTH[@]}" >&2 || true+ exit 1+fi++# Apple recorded the result server-side; stapling copies that ticket into the+# bundle so first launch does not depend on reaching Apple over the network.+echo "==> Stapling the ticket into the bundle"+# notarytool reports Accepted the moment the verdict is recorded, but the+# ticket needs a few more seconds to become downloadable. stapler surfaces+# that window as "file does not exist" naming the .app -- it means the ticket,+# not the bundle -- so retry instead of failing the build on a race.+staple_attempts=6+attempt=1+while true; do+ if xcrun stapler staple "$APP_PATH"; then+ break+ fi+ if [[ "$attempt" -ge "$staple_attempts" ]]; then+ echo "==> Ticket still not available after ${staple_attempts} attempts" >&2+ exit 1+ fi+ echo "==> Ticket not published yet, retrying in 15s (attempt ${attempt}/${staple_attempts})"+ sleep 15+ attempt=$((attempt + 1))+done++echo "==> Verifying"+xcrun stapler validate "$APP_PATH"+codesign --verify --deep --strict --verbose=2 "$APP_PATH"+spctl --assess --verbose=4 --type exec "$APP_PATH"++echo+echo "Notarized and stapled: $APP_PATH"+echo "Re-package it now -- the bundle gained a ticket, so any archive made"+echo "before this point is the unstapled version."diff --git a/ci/macos-package.sh b/ci/macos-package.shnew file mode 100755index 00000000..6cfd1c85--- /dev/null+++ b/ci/macos-package.sh@@ -0,0 +1,161 @@+#!/bin/bash++# Interactive front end for macOS packaging. ci/deploy.sh does the real work;+# this picks a signing mode, verifies that mode's prerequisites before anything+# expensive runs, and reports what Gatekeeper makes of the result.++set -euo pipefail++cd "$(dirname "$0")/.."++. ci/macos-identity.sh++NOTARY_PROFILE=${MACOS_NOTARY_PROFILE:-thinkterm}++usage() {+ cat <<EOT+usage: ci/macos-package.sh [adhoc|developerid] [tag]++ adhoc Self-signed. Fast and offline, but Gatekeeper rejects the+ result everywhere except the machine that built it.+ developerid Developer ID signature, notarization and stapling. Needs+ network and an Apple Developer account; opens on any Mac.++Both arguments are optional -- you are prompted for whatever is missing.+EOT+}++MODE=${1:-}+TAG=${2:-${TAG_NAME:-}}++case "$MODE" in+ -h | --help)+ usage+ exit 0+ ;;+esac++if [[ -z "$MODE" ]]; then+ cat <<'EOT'+ThinkTerm macOS packaging++ 1) Ad-hoc self-signed+ Fast, no network, no Apple account needed.+ Runs on this Mac only -- Gatekeeper rejects it everywhere else.++ 2) Developer ID + notarized+ Signs with your Developer ID certificate, submits to Apple, staples+ the ticket into the bundle. Uploads ~60MB and takes a few minutes.+ Opens on any Mac with no warning, and needs no network to verify.++EOT+ while [[ -z "$MODE" ]]; do+ printf "Select [1/2]: "+ read -r reply || { echo; exit 1; }+ case "$reply" in+ 1) MODE=adhoc ;;+ 2) MODE=developerid ;;+ *) echo "Enter 1 or 2." ;;+ esac+ done+ echo+fi++if [[ "$MODE" != adhoc && "$MODE" != developerid ]]; then+ echo "Unsupported mode: $MODE" >&2+ echo >&2+ usage >&2+ exit 2+fi++if [[ -z "$TAG" ]]; then+ # The tag names the archive, and ci/wezterm-homebrew-macos.rb.template builds+ # its download URL out of it, so it has to match the GitHub release tag byte+ # for byte. The v prefix is not decoration: .github/workflows/release.yml+ # only triggers on 'v*', so every release this has to line up with has one.+ # Deliberately not ci/tag-name.sh's build timestamp -- that identifies a build+ # rather than a release, and `thinkterm --version` already reports it.+ suggested="v$(plutil -extract CFBundleShortVersionString raw \+ assets/macos/ThinkTerm.app/Contents/Info.plist)"+ printf "Version tag [%s]: " "$suggested"+ read -r TAG || { echo; exit 1; }+ TAG=${TAG:-$suggested}+ echo+fi++# The tag becomes a filename inside ci/deploy.sh, which builds paths from it and+# passes them to rm -rf. Whitespace and glob characters are refused here rather+# than relied upon being quoted at every later use.+if [[ ! "$TAG" =~ ^[A-Za-z0-9._-]+$ ]]; then+ echo "Refusing tag: $TAG" >&2+ echo "Use only letters, digits, dot, underscore and dash." >&2+ exit 2+fi++echo "==> Checking prerequisites"++# Catch a missing build here rather than letting deploy.sh fail halfway through+# assembling a bundle it cannot populate.+missing=+for bin in wezterm thinkterm thinkterm-mux-server thinkterm-gui strip-ansi-escapes; do+ [[ -f "target/release/$bin" ]] || missing="$missing $bin"+done+if [[ -n "$missing" ]]; then+ echo "Missing release binaries:$missing" >&2+ echo "Build them first: cargo build --release" >&2+ exit 1+fi+echo " release binaries: present"++if [[ "$MODE" == developerid ]]; then+ identity=$(resolve_signing_identity "Developer ID Application")+ team=$(team_id_from_identity "$identity")+ echo " certificate: $identity"++ # One cheap round trip now beats discovering the credentials are missing+ # after a 60MB upload.+ if ! xcrun notarytool history --keychain-profile "$NOTARY_PROFILE" >/dev/null 2>&1; then+ cat >&2 <<EOT++No usable notarization credentials in keychain profile '$NOTARY_PROFILE'.++Create an app-specific password at https://account.apple.com+(Sign-In and Security > App-Specific Passwords), then store it once:++ xcrun notarytool store-credentials $NOTARY_PROFILE \\+ --apple-id YOUR_APPLE_ID \\+ --team-id $team \\+ --password xxxx-xxxx-xxxx-xxxx+EOT+ exit 1+ fi+ echo " notarization credentials: profile '$NOTARY_PROFILE' works"+fi++echo+echo "==> Packaging as $TAG in $MODE mode"+TAG_NAME="$TAG" MACOS_SIGNING_MODE="$MODE" bash ci/deploy.sh++# deploy.sh derives both names the same way; keep them in sync with it.+zipdir="ThinkTerm-macos${MACOS_ARCH:+-$MACOS_ARCH}-$TAG"+zipname="$zipdir.zip"+app="$zipdir/ThinkTerm.app"++echo+echo "==> Result"+codesign -dv --verbose=2 "$app" 2>&1 |+ grep -E "^Authority=Developer ID Application|^TeamIdentifier=|flags=" || true++# spctl exits non-zero for anything Gatekeeper refuses, which is the expected+# outcome in adhoc mode, so its verdict is reported rather than enforced.+verdict=$(spctl --assess --verbose=4 --type exec "$app" 2>&1 || true)+echo "$verdict" | sed 's/^/ /'++echo+if [[ "$MODE" == developerid ]]; then+ echo "$zipname is signed, notarized and stapled."+ echo "It opens on any Mac, and verifies without network access."+else+ echo "$zipname is ad-hoc signed -- this Mac only."+ echo "Re-run with 'developerid' to produce something distributable."+fidiff --git a/ci/macos-sign-local.sh b/ci/macos-sign-local.shindex 2670f936..540a7f02 100755--- a/ci/macos-sign-local.sh+++ b/ci/macos-sign-local.sh@@ -2,35 +2,38 @@set -euo pipefail-APP_PATH=${1:?usage: macos-sign-local.sh path/to/ThinkTerm.app [adhoc|development]}+APP_PATH=${1:?usage: macos-sign-local.sh path/to/ThinkTerm.app [adhoc|development|developerid]}SIGNING_MODE=${2:-adhoc}-# This is the active Individual team used by the developer's current macOS-# applications. It is public signing metadata, not a credential. Override it-# when intentionally testing with another team.-DEVELOPMENT_TEAM=${THINKTERM_MACOS_DEVELOPMENT_TEAM:-D4KD8XCCL6}+# Extra codesign flags that only the distribution mode needs. Kept as an array+# so the two codesign invocations below stay identical across modes.+CODESIGN_EXTRA=()++. "$(dirname "$0")/macos-identity.sh"++# Resolved against this script, not the caller's cwd: signing an already+# extracted bundle from some other directory is an obvious thing to want, and a+# cwd-relative path would fail only after every nested binary had been re-signed.+ENTITLEMENTS="$(dirname "$0")/macos-entitlement.plist"case "$SIGNING_MODE" inadhoc)SIGNING_IDENTITY=-;;development)- SIGNING_IDENTITY=${MACOS_SIGNING_IDENTITY:-}- if [[ -z "$SIGNING_IDENTITY" ]]; then- SIGNING_IDENTITY=$(- security find-identity -v -p codesigning |- sed -n "s/.*\"\(Apple Development:.*(${DEVELOPMENT_TEAM})\)\".*/\1/p" |- head -n 1- )- fi- if [[ -z "$SIGNING_IDENTITY" ]]; then- echo "No Apple Development identity found for team ${DEVELOPMENT_TEAM}." >&2- echo "Create or download it in Xcode > Settings > Accounts > Manage Certificates." >&2- exit 1- fi+ SIGNING_IDENTITY=$(resolve_signing_identity "Apple Development")+ ;;+ developerid)+ SIGNING_IDENTITY=$(resolve_signing_identity "Developer ID Application")+ # Notarization rejects submissions that lack Hardened Runtime or a secure+ # timestamp, and neither is a codesign default. Both have to be applied to+ # the nested executables as well as the outer bundle, so they live here+ # rather than only on the final seal.+ CODESIGN_EXTRA=(--options runtime --timestamp);;*)- echo "Unsupported signing mode: ${SIGNING_MODE} (expected adhoc or development)" >&2+ echo "Unsupported signing mode: ${SIGNING_MODE}" >&2+ echo "(expected adhoc, development or developerid)" >&2exit 2;;esac@@ -42,23 +45,44 @@ fi# Sign nested executables first, then seal the outer bundle. This avoids# relying on codesign --deep to guess which bundled files are code. Local-# builds can link Homebrew dylibs, so these development-only modes deliberately-# omit Hardened Runtime/library validation. The Developer ID release path in-# deploy.sh continues to enable Hardened Runtime before notarization.+# builds can link Homebrew dylibs, so adhoc and development deliberately omit+# Hardened Runtime/library validation; developerid turns it back on through+# CODESIGN_EXTRA above, because notarization refuses anything without it.+# The ${arr[@]+"${arr[@]}"} dance is not decoration: /bin/bash on macOS is 3.2,+# where `set -u` treats an empty array expansion as an unbound variable.+#+# -perm +111 matches any execute bit. -perm -111 would demand all three, and+# ci/deploy.sh copies these binaries with plain cp, so a caller running under a+# restrictive umask gets 0700 files, matches nothing, and silently ships a+# bundle whose nested binaries were never signed.+#+# The entitlements are deliberately applied to every binary, not just the outer+# seal: only CFBundleExecutable inherits the bundle's entitlements, so the mux+# server and CLIs would otherwise run under Hardened Runtime with an empty set+# and be denied by TCC in developerid builds alone.while IFS= read -r executable; do- codesign --force --sign "$SIGNING_IDENTITY" "$executable"-done < <(find "$APP_PATH/Contents/MacOS" -type f -perm -111 -print | sort)+ codesign --force ${CODESIGN_EXTRA[@]+"${CODESIGN_EXTRA[@]}"} \+ --entitlements "$ENTITLEMENTS" \+ --sign "$SIGNING_IDENTITY" "$executable"+done < <(find "$APP_PATH/Contents/MacOS" -type f -perm +111 -print | sort)-codesign --force \- --entitlements ci/macos-entitlement.plist \+codesign --force ${CODESIGN_EXTRA[@]+"${CODESIGN_EXTRA[@]}"} \+ --entitlements "$ENTITLEMENTS" \--sign "$SIGNING_IDENTITY" \"$APP_PATH"codesign --verify --deep --strict --verbose=2 "$APP_PATH"-if [[ "$SIGNING_MODE" == adhoc ]]; then- echo "Ad-hoc signed ${APP_PATH}; TeamIdentifier is intentionally unset."- echo "Configured development team for the next stage: ${DEVELOPMENT_TEAM}"-else- echo "Development-signed ${APP_PATH} with ${SIGNING_IDENTITY}"-fi+case "$SIGNING_MODE" in+ adhoc)+ echo "Ad-hoc signed ${APP_PATH}; TeamIdentifier is intentionally unset."+ ;;+ development)+ echo "Development-signed ${APP_PATH} with ${SIGNING_IDENTITY}"+ ;;+ developerid)+ echo "Developer ID signed ${APP_PATH} with ${SIGNING_IDENTITY}"+ echo "Hardened Runtime is on, so Gatekeeper will still reject this until it"+ echo "has been notarized and stapled -- see ci/macos-notarize-local.sh."+ ;;+esac