Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

amfidont: Simplify `start_amfidont_for_vphone.sh`

zqxwce367209a1e417
diff --git a/scripts/start_amfidont_for_vphone.sh b/scripts/start_amfidont_for_vphone.sh
old mode 100644
new mode 100755
index 8eb1b82f..a811c31f
--- a/scripts/start_amfidont_for_vphone.sh
+++ b/scripts/start_amfidont_for_vphone.sh
@@ -2,50 +2,24 @@
# start_amfidont_for_vphone.sh — Start amfidont for the current vphone build.
#
# This is the README "Option 2" host workaround packaged for this repo:
-# - computes the signed bundle binary CDHash (what `make boot` actually launches)
-# - uses the .build path so amfidont covers binaries inside the .app bundle
+# - uses the project path so amfidont covers binaries relevant for the project
# - starts amfidont in daemon mode so signed vphone-cli launches are allowlisted
+# - spoofs signatures to be recognized as apple signed for patchless variant
set -euo pipefail
SCRIPT_DIR="${0:A:h}"
PROJECT_ROOT="${SCRIPT_DIR:h}"
-BUNDLE_BIN="${PROJECT_ROOT}/.build/vphone-cli.app/Contents/MacOS/vphone-cli"
-AMFIDONT_BIN="${HOME}/Library/Python/3.9/bin/amfidont"
-[[ -x "$AMFIDONT_BIN" ]] || {
- echo "amfidont not found at $AMFIDONT_BIN" >&2
- echo "Install it first: xcrun python3 -m pip install --user amfidont" >&2
+if ! command -v amfidont &>/dev/null; then
+ echo "amfidont not found" >&2
+ echo "Install it first: xcrun python3 -m pip install -U amfidont" >&2
exit 1
-}
+fi
-[[ -x "$BUNDLE_BIN" ]] || {
- echo "Missing bundle binary: $BUNDLE_BIN" >&2
- echo "Run 'make bundle' first." >&2
- exit 1
-}
-
-CDHASH="$(
- codesign -dv --verbose=4 "$BUNDLE_BIN" 2>&1 \
- | sed -n 's/^CDHash=//p' \
- | head -n1
-)"
-[[ -n "$CDHASH" ]] || {
- echo "Failed to extract CDHash for $BUNDLE_BIN" >&2
- exit 1
-}
-
-# amfidont --path must cover the actual binary location inside the .app
-AMFI_PATH="${PROJECT_ROOT}/.build"
-ENCODED_AMFI_PATH="${AMFI_PATH// /%20}"
-
-echo "[*] Project root: $PROJECT_ROOT"
-echo "[*] AMFI path: $AMFI_PATH"
-echo "[*] Bundle CDHash: $CDHASH"
-
-sudo env PYTHONPATH="/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python" \
- /usr/bin/python3 "$AMFIDONT_BIN" daemon \
- --path "$ENCODED_AMFI_PATH" \
- --cdhash "$CDHASH" \
- --verbose \
+sudo xcrun amfidont daemon \
+ --path "$PROJECT_ROOT" \
+ --spoof-apple \
>/dev/null 2>&1
+
+echo "amfidont started"