Page 1 of 1

Notarizing PB-Apps

Posted: Thu Feb 09, 2023 12:54 am
by jamirokwai
Hi there,

maybe, I accomplished the notarization of my PureBasic-App. It's for M1-Macs, please try it out.

The Process is very easy :-/

0. Register for the Developer Program at Apple (99 Bucks/year), may be also working with a free account. You get certificates and stuff, which are important for this. So you have a developer Apple-ID and the "Developer ID Application: xxx"

1. Create your myapp.app

2. Register a new bundle-id (e.g. com.ducks-on-the-water.retro-painter) and create an App (that may be omitted, but I created it)
https://developer.apple.com/account/res ... add/bundle

3. Add an App-specific password in your developers Apple-ID
https://appleid.apple.com/account/manage

4. Codesign your App

Code: Select all

codesign --force --options runtime --timestamp --sign "Developer ID Application: xxx" "/path/to/myapp.app"
5. zip it to my myapp.app.zip

6. notarise it

Code: Select all

xcrun notarytool submit "/path/to/myapp.app.zip" --apple-id "the one used in step 2" --password "from step 3" --team-id "find in step 3"
you will get an ID

7. after a few minutes, have a look into the log

Code: Select all

xcrun notarytool log "ID from step 6" --apple-id "the one used in step 2" --password "from step 3" --team-id "find in step 3"
8. unzip it

9. staple it

Code: Select all

xcrun stapler staple "/path/to/myapp.app"
10 check it

Code: Select all

spctl --assess -vv --type install "/path/to/myapp.app"
11. zip it again and ship it!

That's it. Apples Transporter.app only accepts .PKG. If I succeed in signing and notarizing .PKG as well, I will edit the next post!

Re: Notarizing PB-App

Posted: Thu Feb 09, 2023 12:54 am
by jamirokwai
reserved

Re: Notarizing PB-Apps

Posted: Thu Feb 09, 2023 1:35 am
by jamirokwai
If you want to combine the M1 and the x64-binary, use LIPO on the command line.

Code: Select all

lipo -create "/path/to/m1.app/Contents/MacOS/m1" "/path/to/x64.app/Contents/MacOS/x64" -output "universal"
You can check the app with

Code: Select all

file ./universal
Now you can sign and notarize the App. See first post.



Edit, because of mrbungles question below.

You have to copy the file universal into the .app-bundle, under Contents/MacOS. If you user the bundle /path/to/m1.app/Contents/MacOS/m1, replace the file m1 with the file universal, but rename it to m1.

Code: Select all

file ./path/to/m1.app/Contents/MacOS/universal"
spat out this:

Code: Select all

./universal (for architecture x86_64): Mach-O 64-bit executable x86_64
./universal (for architecture arm64):  Mach-O 64-bit executable arm64

Re: Notarizing PB-Apps

Posted: Thu Feb 09, 2023 9:14 am
by Fred
I did the same for the PB package and it was really a pain to do.. Thanks for the detailed guide, it can help.

Re: Notarizing PB-Apps

Posted: Fri Feb 10, 2023 1:14 pm
by mrbungle
Thanks for posting this. I was able to generate a universal build of a simple app but it didn't execute properly (it loaded but nothing else). Is there anything else we need to do to get this to work properly? Like set some permissions or flags?

Re: Notarizing PB-Apps

Posted: Fri Feb 10, 2023 10:13 pm
by jamirokwai
mrbungle wrote: Fri Feb 10, 2023 1:14 pm Thanks for posting this. I was able to generate a universal build of a simple app but it didn't execute properly (it loaded but nothing else). Is there anything else we need to do to get this to work properly? Like set some permissions or flags?
Hey, mrbungle!

No, no permissions or flags were needed on my Mac.
See the post above. I added a few sentences. It's working this way!

Re: Notarizing PB-Apps

Posted: Fri Feb 10, 2023 11:51 pm
by mrbungle
Ah ok. This makes sense now, yeah I think I got it to work!

Thanks!