- For Developers
- ›
- Platforms
macOS Notarization Setup Guide
This guide explains how to set up macOS notarization for the Sila desktop app, both for local development and CI/CD builds.
What is Notarization?
Notarization is Apple's process for verifying that your app is safe to run on macOS. When users try to run a notarized app for the first time, macOS will show a message saying the app has been checked for malicious software.
Prerequisites
- Apple Developer Account: You need a paid Apple Developer account
- App-Specific Password: Generate an app-specific password for notarization
- Code Signing Certificate: A Developer ID Application certificate
Required Environment Variables
For notarization to work, you need to set these environment variables:
# Apple Developer account email
export APPLE_ID="your-apple-id@example.com"
# App-specific password (not your regular Apple ID password)
# Preferred name used across the repo and CI
export APPLE_APP_SPECIFIC_PASSWORD="your-app-specific-password"
# Optional but recommended if you are in multiple teams
export APPLE_TEAM_ID="UY76UFAS3C"
Setting Up App-Specific Password
- Go to Apple ID website
- Sign in with your Apple Developer account
- Go to "Security" → "App-Specific Passwords"
- Click "Generate Password"
- Give it a name like "Sila Notarization"
- Copy the generated password (it won't be shown again)
Local Development Setup
Option 1: Environment Variables (Recommended)
Create a .env
file in the packages/desktop
directory:
# packages/desktop/.env
APPLE_ID=your-apple-id@example.com
APPLE_APP_SPECIFIC_PASSWORD=your-app-specific-password
# Optional if you belong to multiple teams
# APPLE_TEAM_ID=UY76UFAS3C
Then modify the build script to load these variables:
# In packages/desktop/package.json, update the build script:
"build:electron": "source .env 2>/dev/null || true && electron-builder"
Option 2: Direct export
Export the variables before building:
export APPLE_ID="your-apple-id@example.com"
export APPLE_APP_SPECIFIC_PASSWORD="your-app-specific-password"
# Optional
# export APPLE_TEAM_ID="UY76UFAS3C"
npm run build
Option 3: Disable Notarization for Development
If you don't need notarization during development, you can temporarily disable it:
// In packages/desktop/package.json
{
"build": {
"mac": {
"notarize": false
}
}
}
CI/CD Setup (GitHub Actions)
The project is configured for signing and notarization in CI. Configure these:
- Repository variables:
APPLE_ID
: Apple Developer account emailAPPLE_TEAM_ID
: Apple Team ID (if applicable)
- Repository secrets:
APPLE_APP_SPECIFIC_PASSWORD
: App-specific password (not your Apple ID password)PROD_MACOS_CERTIFICATE
: Base64 of .p12 (Developer ID Application cert + private key)PROD_MACOS_CERTIFICATE_PWD
: Password used when exporting the .p12PROD_MACOS_CERTIFICATE_NAME
: Exact certificate name from Keychain (e.g., "Developer ID Application: Dmitrii Kurilchenko (UY76UFAS3C)")PROD_MACOS_CI_KEYCHAIN_PWD
: Random password used to create/unlock the temporary CI keychain
Testing Notarization
1. Build with Notarization
cd packages/desktop
export APPLE_ID="your-apple-id@example.com"
export APPLE_APP_SPECIFIC_PASSWORD="your-app-specific-password"
npm run build
2. Check Notarization Status
After building, you can check if notarization was successful:
# Using notarytool (recommended)
xcrun notarytool history --apple-id "$APPLE_ID" --password "$APPLE_APP_SPECIFIC_PASSWORD" --team-id "$APPLE_TEAM_ID"
# Legacy altool (if needed)
xcrun altool --notarization-info <UUID> -u "$APPLE_ID" -p "$APPLE_APP_SPECIFIC_PASSWORD"
3. Verify the App
# Check if the app is properly signed and notarized
codesign --verify --verbose --deep --strict dist/mac/Sila.app
spctl --assess --verbose --type exec dist/mac/Sila.app
Troubleshooting
Common Issues
- "notarize options were unable to be generated"
- Missing
APPLE_ID
orAPPLE_APP_SPECIFIC_PASSWORD
- Solution: Set the required environment variables
- Missing
- "Invalid credentials"
- Wrong Apple ID or using regular password instead of app-specific
- Solution: Generate a new app-specific password and set
APPLE_APP_SPECIFIC_PASSWORD
- "No identity found"
- Missing code signing certificate
- Solution: Install the Developer ID Application certificate
- "The operation couldn't be completed"
- Network issues or Apple's servers are down
- Solution: Try again later
Debug Notarization
Enable verbose logging:
export DEBUG=electron-builder
npm run build
Check Notarization History
# List recent notarization requests
xcrun altool --list-notarization-history -u <APPLE_ID> -p <APPLE_ID_PASS>
Security Best Practices
- Never commit credentials: Use environment variables or secrets
- Use app-specific passwords: Don't use your main Apple ID password
- Rotate credentials regularly: Update app-specific passwords periodically
- Limit access: Only give necessary team members access to notarization credentials
Alternative: Skip Notarization for Development
If you're only developing locally and don't need notarization:
// In packages/desktop/package.json
{
"build": {
"mac": {
"notarize": false,
"hardenedRuntime": false,
"gatekeeperAssess": false
}
}
}