| 1 | # Signing MacOS binaries |
| 2 | relic has preliminary support for signing MacOS and iOS binaries. |
| 3 | |
| 4 | For example, to sign a Mac binary for offline distribution, you will need a DevID certificate. |
| 5 | Configure relic to use the cert with Apple's timestamp servers: |
| 6 | |
| 7 | ```yaml |
| 8 | keys: |
| 9 | devid: |
| 10 | token: file |
| 11 | x509certificate: ./devid.crt |
| 12 | keyfile: ./devid.key |
| 13 | timestamp: true |
| 14 | |
| 15 | tokens: |
| 16 | file: |
| 17 | type: file |
| 18 | timestamp: |
| 19 | urls: |
| 20 | - http://timestamp.apple.com/ts01 |
| 21 | ``` |
| 22 | |
| 23 | Binaries should be signed with the `hardened-runtime` flag is set or notarization will fail: |
| 24 | |
| 25 | relic sign -k devid -f foo-darwin-amd64 --hardened-runtime |
| 26 | |
| 27 | Note also that relic currently does not support signing multi-arch ("fat") binaries, although it can verify them. |
| 28 | Sign each arch separately and then combine them afterwards: |
| 29 | |
| 30 | go install github.com/randall77/makefat@latest |
| 31 | makefat foo foo-darwin-amd64 foo-darwin-arm64 |
| 32 | relic verify foo |
| 33 | |
| 34 | The signed binary can then be placed into a regular zip file and uploaded for notarization. |