diff --git a/Scripts/compile_and_run.sh b/Scripts/compile_and_run.sh index ce6992d45..094921bff 100755 --- a/Scripts/compile_and_run.sh +++ b/Scripts/compile_and_run.sh @@ -20,6 +20,14 @@ SIGNING_MODE="${CODEXBAR_SIGNING:-}" log() { printf '%s\n' "$*"; } fail() { printf 'ERROR: %s\n' "$*" >&2; exit 1; } +delete_keychain_service_items() { + local service="$1" + security delete-generic-password -s "${service}" >/dev/null 2>&1 || true + while security delete-generic-password -s "${service}" >/dev/null 2>&1; do + : + done +} + has_signing_identity() { local identity="${1:-}" if [[ -z "${identity}" ]]; then @@ -180,12 +188,11 @@ kill_claude_probes # 2.5) Delete keychain entries to avoid permission prompts with adhoc signing # (adhoc signature changes on every build, making old keychain entries inaccessible) if [[ "${SIGNING_MODE:-adhoc}" == "adhoc" ]]; then - log "==> Clearing keychain entries (adhoc signing)" - security delete-generic-password -s "com.steipete.CodexBar" 2>/dev/null || true - # Clear all keychain items for the app to avoid multiple prompts - while security delete-generic-password -s "com.steipete.CodexBar" 2>/dev/null; do - : - done + log "==> Clearing CodexBar keychain entries (adhoc signing)" + # Clear both the legacy keychain store and the current cache service. Leaving CodexBar-owned caches behind causes + # fresh adhoc-signed builds to re-open stale ACLs and repeatedly prompt for keychain access/password approval. + delete_keychain_service_items "com.steipete.CodexBar" + delete_keychain_service_items "com.steipete.codexbar.cache" fi # 3) Package (release build happens inside package_app.sh). diff --git a/docs/DEVELOPMENT_SETUP.md b/docs/DEVELOPMENT_SETUP.md index a32098e4e..99c4e2711 100644 --- a/docs/DEVELOPMENT_SETUP.md +++ b/docs/DEVELOPMENT_SETUP.md @@ -15,6 +15,9 @@ When developing CodexBar, you may see frequent keychain permission prompts like: > **CodexBar wants to access key "Claude Code-credentials" in your keychain.** This happens because each rebuild creates a new code signature, and macOS treats it as a "different" app. +That can affect both CodexBar-owned entries (`com.steipete.CodexBar`, `com.steipete.codexbar.cache`) and +third-party items such as `Claude Code-credentials`, so an ad-hoc-signed rebuild can keep re-triggering +password/keychain approval dialogs even after you previously chose **Always Allow**. ### Quick Fix (Temporary) @@ -101,6 +104,11 @@ This script: 5. Launches `CodexBar.app` 6. Verifies it stays running +When the script falls back to ad-hoc signing, it also clears CodexBar-owned keychain services before relaunching so +the new build does not inherit stale ACLs from the previous app identity. +This reduces repeat prompts for CodexBar-managed cache entries, but third-party keychain items still need stable +signing if you want macOS to remember **Always Allow** across rebuilds. + ### Quick Build (No Tests) ```bash