Files
astral-uv/scripts/codesign-macos.sh
T
Zanie Blue 6caa08adba Add a nextest setup hook and optional code signing for tests on macOS (#17542)
Uses a nextest setup hook to sign the uv and test binaries before
running the tests. This allows you to grant permission to the test suite
_once_ when running native authentication tests on macOS. Otherwise, you
get prompted on every access on every binary change.
2026-01-20 08:43:40 -06:00

37 lines
727 B
Bash
Executable File

#!/usr/bin/env bash
#
# Sign macOS binaries with a code signing identity.
#
# Usage:
#
# Sign binaries with the given identity:
#
# $ ./scripts/codesign-macos.sh <identity> <target>...
#
# For example:
#
# $ ./scripts/codesign-macos.sh "Mac Developer: Your Name (TEAM_ID)" target/debug/uv
#
# Use `security find-identity -v -p codesigning` to list available identities.
set -euo pipefail
if [[ "$(uname)" != "Darwin" ]]; then
echo "Not on macOS, skipping" >&2
exit 0
fi
if [[ $# -lt 2 ]]; then
echo "Usage: codesign-macos.sh <identity> <target>..." >&2
exit 1
fi
identity="$1"
shift
for target in "$@"; do
if [[ -f "$target" ]]; then
codesign --force --sign "$identity" "$target"
fi
done