Skip to content

Instantly share code, notes, and snippets.

@pourmand1376
Last active August 22, 2025 09:55
Show Gist options
  • Save pourmand1376/3f2740a18ee3ec6d55b785d418b720b5 to your computer and use it in GitHub Desktop.
Save pourmand1376/3f2740a18ee3ec6d55b785d418b720b5 to your computer and use it in GitHub Desktop.
Fix Mac Apps - Security Error
# Add this function to your shell profile (e.g., ~/.zshrc or ~/.bashrc)
fix_app() {
if [ -z "$1" ]; then
echo "Usage: fix_app <FullPathToApp>"
return 1
fi
APP_PATH="$1"
if [ ! -d "$APP_PATH" ]; then
echo "Error: $APP_PATH does not exist."
return 1
fi
# Clear extended attributes
xattr -c "$APP_PATH"
# Force re-sign with an ad-hoc signature
codesign --force --sign - "$APP_PATH"
echo "Successfully fixed codesign and attributes for $APP_PATH"
}
# Example usage after sourcing your profile:
# fix_app "/Applications/app_name.app"
@pourmand1376
Copy link
Author

If you don't want to add it to .zshrc or anything, Just copy this code to your terminal and hit enter.

Then use fix_app <your_app_path> and everything would be ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment