Skip to content

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.

Add local macOS package signing

RoversXe9f453dd4e0a
diff --git a/ci/deploy.sh b/ci/deploy.sh
index b3438c6e..de5ad984 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -54,7 +54,9 @@ case $OSTYPE in
done
set +x
- if [ -n "$MACOS_TEAM_ID" ] ; then
+ if [[ -n "${MACOS_SIGNING_MODE:-}" ]] ; then
+ bash ci/macos-sign-local.sh "$zipdir/ThinkTerm.app" "$MACOS_SIGNING_MODE"
+ elif [ -n "$MACOS_TEAM_ID" ] ; then
MACOS_PW=$(echo $MACOS_CERT_PW | base64 --decode)
echo "pw sha"
echo $MACOS_PW | shasum
@@ -85,13 +87,18 @@ case $OSTYPE in
security default-keychain -d user -s $def_keychain
echo "Remove build.keychain"
security delete-keychain build.keychain || true
+ else
+ # A normal local package should still be a correctly sealed app bundle.
+ # Development/Developer ID identities remain opt-in, but ad-hoc signing
+ # is a safer and less surprising default than producing an invalid app.
+ bash ci/macos-sign-local.sh "$zipdir/ThinkTerm.app" adhoc
fi
set -x
zip -r $zipname $zipdir
set +x
- if [ -n "$MACOS_TEAM_ID" ] ; then
+ 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"
fi
diff --git a/ci/macos-sign-local.sh b/ci/macos-sign-local.sh
new file mode 100755
index 00000000..2670f936
--- /dev/null
+++ b/ci/macos-sign-local.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+set -euo pipefail
+
+APP_PATH=${1:?usage: macos-sign-local.sh path/to/ThinkTerm.app [adhoc|development]}
+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}
+
+case "$SIGNING_MODE" in
+ adhoc)
+ 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
+ ;;
+ *)
+ echo "Unsupported signing mode: ${SIGNING_MODE} (expected adhoc or development)" >&2
+ exit 2
+ ;;
+esac
+
+if [[ ! -d "$APP_PATH" ]]; then
+ echo "App bundle not found: ${APP_PATH}" >&2
+ exit 1
+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.
+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 \
+ --entitlements ci/macos-entitlement.plist \
+ --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