#!/bin/bash # # Example Usage: # # ./codesign_macos.sh test.app/Contents/MacOs/test ./ # # To use this file properly, you need to create a signing identity, and # replace the string with the code Apple provides. # See ./how_to_setup_for_macos_and_ios_development.md for instructions CODE_SIGN_IDENTITY="" PATH_TO_EXECUTABLE=$1 PATH_TO_ENTITLEMENTS_FILE=$2 app_entitlements_file="$PATH_TO_ENTITLEMENTS_FILE/Entitlements.xcent" echo "Codesigning..." echo " Executable: ${PATH_TO_EXECUTABLE}" echo " Entitlements {app_entitlements_file}" echo # Do the actual codesigning codesign \ --generate-entitlement-der \ --force \ --timestamp\=none \ --entitlements ${app_entitlements_file} \ --sign $CODE_SIGN_IDENTITY \ ${PATH_TO_EXECUTABLE} if [ $? -ne 0 ]; then echo echo " Code signing Failed" exit 1 fi