From c846bc245c75d415eb4adb4e47ea516f01ded582 Mon Sep 17 00:00:00 2001 From: Adam Harrison-Fuller Date: Wed, 29 Jul 2026 03:06:31 +0100 Subject: [PATCH] Wait for bootout to complete before bootstrapping the daemon launchctl bootout returns before the job is actually gone. Bootstrapping into that gap fails with "Bootstrap failed: 5: Input/output error" and, because the script runs under set -e, exits with nothing loaded at all -- taking speech-to-text down rather than reinstalling it. Poll until the label disappears, and fail with an actionable message if it does not. Co-Authored-By: Claude Opus 5 --- install.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 8831c39..ac59c45 100755 --- a/install.sh +++ b/install.sh @@ -161,8 +161,20 @@ sudo cp "$TMP_PLIST" "$PLIST" sudo chown root:wheel "$PLIST" sudo chmod 644 "$PLIST" +# bootout returns before the job is actually gone; bootstrapping into the +# gap fails with "Bootstrap failed: 5: Input/output error" and leaves nothing +# loaded at all. Wait for it to disappear first. sudo launchctl bootout "system/$LABEL" 2>/dev/null || true -sudo launchctl bootstrap system "$PLIST" +for _ in $(seq 1 30); do + sudo launchctl print "system/$LABEL" >/dev/null 2>&1 || break + sleep 1 +done +if sudo launchctl print "system/$LABEL" >/dev/null 2>&1; then + die "$LABEL is still loaded after bootout; unload it manually and retry" +fi + +sudo launchctl bootstrap system "$PLIST" \ + || die "bootstrap failed; the service is not running. Check: sudo launchctl print system/$LABEL" echo "==> Waiting for the service to come up" for _ in $(seq 1 60); do