Signing for macOS
Ezen az oldalon
An unsigned Mac build refuses to open at all on a modern macOS — the user gets "cannot be opened because the developer cannot be verified", and the way past it is obscure enough that most people give up.
Two things fix that, and they are separate: signing proves the build came from you, and notarising proves Apple has scanned it. You need both for a download. Signing alone is enough for a build you hand to a colleague.
What you need
An Apple Developer Program membership (99 USD a year) and a Developer ID Application certificate.
Note the name. Apple issues several kinds and they are not interchangeable:
| Certificate | For |
|---|---|
| Developer ID Application | a build people download from your own site — this one |
| Apple Distribution | a build going to the Mac App Store, and iOS |
| Mac Installer Distribution | the installer package around a Mac App Store build |
The Mac App Store has a card of its own.
Getting the .p12
- On a Mac, open Keychain Access → Certificate Assistant → Request a Certificate from a Certificate Authority. Save the request to disk. This generates the private key locally — the request is useless to anyone else, and the certificate Apple gives back is useless without it.
- Go to Certificates, Identifiers & Profiles, create a Developer ID Application certificate and upload that request.
- Download the certificate and double click it to install it into Keychain.
- In Keychain Access, find it under My Certificates — it must show a disclosure triangle with a private key underneath. If it does not, you are on a different Mac from the one that made the request.
- Right click → Export →
.p12, and set a password.
Do not create two certificates with the same name. Exporting then becomes a guess about which one you picked.
The provisioning profile
A game whose [apple] capabilities names Game Center, Sign in with
Apple, iCloud or push claims entitlements Apple restricts on macOS. A
signed build that claims one needs a Developer ID provisioning profile
inside it, or macOS refuses to start it, so Forge fails such a build
without one rather than ship it.
- Under Identifiers, open the App ID with your bundle id and tick the capabilities your game uses.
- Under Profiles, create a Developer ID profile for that App ID with your Developer ID Application certificate.
- Download the
.provisionprofile.
The signer embeds it as Contents/embedded.provisionprofile, takes
aps-environment from it, and leaves out what it does not grant. A
Developer ID profile never grants Sign in with Apple, In-App Purchase or
Game Center: Apple keeps those for the Mac App Store,
and the download answers unsupported for them. A game with no
capabilities, or only in-app-purchase, needs no profile.
What to put in Forge
| Field | What |
|---|---|
| Developer ID Application (.p12) | the exported file |
| Certificate password | the password you set on export |
| Developer ID provisioning profile (.provisionprofile) | optional: the profile, once your game claims a capability |
Forge signs on Linux using rcodesign,
a clean-room implementation of Apple's format. We verified the output with
Apple's own codesign on a Mac: valid on disk, satisfies its Designated
Requirement, full chain to the Apple Root CA. You do not need a Mac.
Then notarise
Signing is half of it. See Apple notarisation for the other half — without it, macOS still warns on anything downloaded from the internet.