4.3 KiB
macOS Notarization Setup
This document explains how to set up notarization for macOS builds of MQTT Explorer.
Overview
macOS notarization is a security feature required by Apple for all software distributed outside the Mac App Store. Starting with macOS 10.15 (Catalina), all software must be notarized to run without warnings on macOS.
Prerequisites
- An active Apple Developer account
- Xcode command line tools installed on the build machine
- An app-specific password for notarization
Setup Steps
1. Create an App-Specific Password
- Sign in to appleid.apple.com
- Navigate to "Sign-In and Security" section
- Under "App-Specific Passwords", click "Generate an app-specific password"
- Enter a descriptive name (e.g., "MQTT Explorer Notarization")
- Copy the generated password (you won't be able to see it again)
2. Find Your Team ID
- Sign in to developer.apple.com
- Navigate to "Membership Details"
- Copy your Team ID (a 10-character alphanumeric string)
3. Configure GitHub Secrets
Add the following secrets to your GitHub repository:
APPLE_ID: Your Apple ID email address (e.g.,your.email@example.com)APPLE_APP_SPECIFIC_PASSWORD: The app-specific password created in step 1APPLE_TEAM_ID: Your Team ID from step 2
To add secrets:
- Go to your repository on GitHub
- Navigate to Settings → Secrets and variables → Actions
- Click "New repository secret" for each of the above
How It Works
Build Configuration
The notarization process is configured in package.json:
{
"build": {
"mac": {
"hardenedRuntime": true,
"gatekeeperAssess": false,
"entitlements": "res/entitlements.mac.plist",
"entitlementsInherit": "res/entitlements.mac.inherit.plist"
},
"afterSign": "./dist/scripts/notarize.js"
}
}
Notarization Script
The scripts/notarize.ts script handles the notarization process:
- Checks if the build is for macOS
- Verifies that required environment variables are set
- Submits the app to Apple's notarization service
- Waits for notarization to complete
- Staples the notarization ticket to the app
Entitlements
Different entitlements are used for different build types:
-
DMG builds (regular distribution):
res/entitlements.mac.plist- Main entitlementsres/entitlements.mac.inherit.plist- Inherited entitlements for child processes
-
MAS builds (Mac App Store):
res/entitlements.mas.plist- App Store specific entitlements
CI/CD Integration
The GitHub Actions workflow (platform-builds.yml) automatically:
- Builds the macOS app when code is pushed to
releaseorbetabranches - Signs the app with the developer certificate
- Notarizes the app using the configured secrets
- Publishes the notarized app to GitHub releases
Troubleshooting
Notarization Fails
If notarization fails, check:
- Credentials: Ensure all three secrets are correctly set in GitHub
- App-specific password: Verify it hasn't expired or been revoked
- Team ID: Confirm it matches your developer account
- Entitlements: Ensure the entitlements files are valid and appropriate for your app
Checking Notarization Status
You can check the notarization status of a built app:
# Check if an app is notarized
spctl -a -vv /path/to/MQTT\ Explorer.app
# Check notarization history
xcrun notarytool history --apple-id your.email@example.com --team-id YOUR_TEAM_ID
Local Testing
To test notarization locally:
# Set environment variables
export APPLE_ID="your.email@example.com"
export APPLE_APP_SPECIFIC_PASSWORD="your-app-specific-password"
export APPLE_TEAM_ID="YOUR_TEAM_ID"
# Build and notarize
yarn build
yarn package mac
Security Considerations
- Never commit Apple credentials to the repository
- Use app-specific passwords, not your main Apple ID password
- Rotate app-specific passwords periodically
- Limit access to GitHub secrets to trusted maintainers only