docs/update-mac-certificates.md
Related macOS docs:
- build-and-publish-notes.md -- Build/publish workflow (screenshots, iOS, Windows signing)
- mac-app-store-code-signing-guide.md -- Code signing setup and troubleshooting
Mac access required! The instructions below refresh every asset used by the GitHub Actions/macOS runners for Mac App Store (MAS) and direct-download (DMG) builds.
⚠️ Note: Deleting old certificates also removes their private keys. If you don’t have the private key backed up, generate a new CSR before creating new certificates (so maybe we should not delete the certificates too early?).
Keychain Access → My Certificates - open -a "Keychain Access" ) so you do not export the wrong private key later.mac-dev-team.csr.Create the following certificates in the developer portal, using the CSR from step 2:
.pkg that is uploaded via Transporter..pkg for DMG distribution (still required by electron-builder when dist:mac:dl runs).
Download each resulting .cer file and note the exact label Apple shows so you can cross-check in CI logs later..cer so it lands inside the login keychain under “My Certificates”. You should now see each certificate with a disclosure triangle that reveals the paired private key—if the triangle is missing, delete the cert and regenerate it so the private key attaches properly.all-certs.p12, and choose a strong password (this password becomes the MAC_CERTS_PASSWORD). Confirm the repeated macOS password prompts.
security export -k ~/Library/Keychains/login.keychain-db \
-t identities -f pkcs12 -P "$MAC_CERTS_PASSWORD" \
-o all-certs.p12
all-certs.p12 onto another Mac before proceeding.base64 -i all-certs.p12 -o all-certs.b64.MAC_CERTS with the contents of all-certs.b64 and the secret MAC_CERTS_PASSWORD with the password chosen above.CSC_LINK: ${{ secrets.MAC_CERTS }}
CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTS_PASSWORD }}
CSC_IDENTITY_AUTO_DISCOVERY: true
CSC_INSTALLER_LINK/CSC_INSTALLER_KEY_PASSWORD if you decide to store installer identities separately.MAC_DISTRIBUTION_CERT, but the current workflow expects a single bundle. Whatever approach you choose, ensure the CI job imports the PKCS#12 into an unlocked keychain before invoking electron-builder.Important: create/refresh profiles after the new certificates exist, otherwise downloading the profile will still pull the revoked certs.
Apple Distribution certificate → choose the MAS App ID → download as mas.provisionprofile.Developer ID Application certificate → choose the same App ID → download as dl.provisionprofile (optional for most Developer ID apps, but we keep it to satisfy older tooling and entitlements checks).tools/mac-profiles/mas.provisionprofile and tools/mac-profiles/dl.provisionprofile (keep the exact filenames so the build scripts pick them up). If you skip the Developer ID profile, remove tools/mac-profiles/dl.provisionprofile and clear the DL_PROVISION_PROFILE secret so CI doesn’t look for it.base64 -i tools/mac-profiles/dl.provisionprofile -o dmg-profile.b64
base64 -i tools/mac-profiles/mas.provisionprofile -o mas-profile.b64
DL_PROVISION_PROFILE (dmg) and MAS_PROVISION_PROFILE (store) with the encoded strings and ensure the workflows pass them to electron-builder (e.g., build.mac.provisioningProfile). Remember to keep hardened runtime enabled (build.mac.hardenedRuntime=true) and entitlements aligned for notarization.See also:
xcrun notarytool (Apple blocked altool uploads as of 2023‑11‑01). electron-builder defaults to notarytool when it detects Xcode 14+, so avoid overriding that behavior.APPLEID="[email protected]" \
APPLEIDPASS="app-specific-password" \
rm -Rf app-builds && npm run build && npm run dist:mac:dl
notarytool), and staples the DMG using the new certificates and provisioning profiles. Validate with spctl --assess -vv --type install path/to/app.