- 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)
export APPLE_ID_PASSWORD="your-app-specific-password"
# Optional but recommended if you are in multiple teams
export APPLE_TEAM_ID="UY76UFAS3C"
# Code signing certificate (for CI/CD)
export CSC_LINK="path-to-certificate.p12"
# Certificate password
export CSC_KEY_PASSWORD="certificate-password"
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_ID_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_ID_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 already has GitHub Actions configured for notarization. The workflow uses these secrets:
APPLE_ID
: Your Apple Developer account emailAPPLE_ID_PASSWORD
: Your app-specific passwordMACOS_CERTIFICATE_P12
: Base64-encoded code signing certificateMACOS_CERTIFICATE_PASSWORD
: Certificate password
Testing Notarization
1. Build with Notarization
cd packages/desktop
export APPLE_ID="your-apple-id@example.com"
export APPLE_ID_PASS="your-app-specific-password"
npm run build
2. Check Notarization Status
After building, you can check if notarization was successful:
# Check the notarization status (legacy altool)
xcrun altool --notarization-info <UUID> -u "$APPLE_ID" -p "$APPLE_ID_PASSWORD"
# Or using notarytool if configured
xcrun notarytool history --apple-id "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --team-id "$APPLE_TEAM_ID"
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_ID_PASS
environment variables - Solution: Set the required environment variables
- Missing
- "Invalid credentials"
- Wrong Apple ID or password
- Using regular password instead of app-specific password
- Solution: Generate a new 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
}
}
}