Skip to content

Instantly share code, notes, and snippets.

@gingerbeardman
Created October 12, 2025 17:05
Show Gist options
  • Select an option

  • Save gingerbeardman/d8247a409cc17e66b9724e6166916438 to your computer and use it in GitHub Desktop.

Select an option

Save gingerbeardman/d8247a409cc17e66b9724e6166916438 to your computer and use it in GitHub Desktop.
This script extracts an app from an Xcode .xcarchive, alerts the user, kills any running versions, moves it to /Applications, re-signs it with the specified Developer ID, and then launches the newly signed app.
FILE=`basename "$@" .xcarchive`
PARENT=`dirname "$@"`
ditto "$@"/Products/Applications/ $PARENT/.
printf "\a"
# List all .app directories in $PARENT
for app_path in "$PARENT"/*.app; do
# Extract the app name (basename without .app extension)
app_name=$(basename "$app_path" .app)
pkill -f $app_name
# Remove the app from /Applications
rm -rf "/Applications/$app_name.app"
mv "$PARENT/$app_name.app" "/Applications/"
# Code signing the application
codesign --deep --force --verify --verbose --sign "Developer ID Application: Your Name (A1B234CD56)" "/Applications/$app_name.app"
# Open the app
open "/Applications/$app_name.app"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment