There are a lot of steps involved with notarizing macOS applications for distribution outside the macOS App Store. DotPurple can automate much of this process, but many things you will have to do yourself. This page gives you all the details! Make sure to click on any images you want to view in a larger size.
Note that DotPurple only supports code signing notarization on macOS. This is because the tools needed for code signing and notarization are not available on Windows or Linux.
macOS .app creation, code signing, and notarization is only available for DotPurple Pro licenses.
Here are all the steps you'll need to do BEFORE using DotPurple to help ease your notarization process. You would probably need to do these even if you weren't using DotPurple!
Install Xcode for some command line tools that you'll need to complete the notarization process. You can do the rest of the setup while Xcode is downloading and installing.
Note: If you have troubles with some tools (like "xcrun") not being called properly in Xcode, install Xcode to a non-default path, have multiple versions of Xcode installed, or otherwise don't have "xcrun" and "codesign" and other tools in your command-line path, please follow the directions on this StackOverflow post for some good troubleshooting tips on SO for getting your Xcode CLI tools setup properly.
If you have already enrolled, skip to step 10. If not, visit the Apple Developer enrollment page to start the process.
Note that if you are an organization/company, there may be extra steps involved with creating your account that this tutorial will not cover.
You will need to fill in your billing details, might have to sign in again to your Apple ID, and do other things to complete the process.
This is only necessary if your Apple ID belongs to more than one team.
Search for the Developer ID certificate that you just installed (search for "Developer ID" in the search bar). It will have your developer name in it, and it will expire 5 years from the date you created it. This verifies that the certificate is installed.
Copy the "Common Name" field. ("Developer ID Application: My Name (AAA4U1PBBB)"). In DotPurple, this text should be put in the "Code Signing Identity" text box. You'll need this later along with your app specific password (see next step).
If you belong to more than one organization, you might also need the text under "Organizational Unit", so copy that somewhere and save it too. (also known as your organizational ID -- sequence of letters and numbers in all caps). In DotPurple, this is called the Provider Short Name.
You now need to add your app specific password from step 10 to Keychain Access. Click the + button near the top left in Keychain Access, give the item a name (you'll need this exact keychain name later -- it goes in DotPurple in the Notarization section under "Keychain Access Password Name", so don't forget it), give it an account name (same as your Apple ID username/email), and put the password in the Password box. Make sure not to copy any whitespace! Click "Add" to save it to your keychain.
Note: On some systems, you may need to allow all applications to access your Keychain Access app specific password. To make this change, find your app specific password in Keychain Access and double click it to open its attributes and access control. Click the "Access Control" tab, choose to allow all applications to access the keychain item, then save changes. (You can choose to allow access just to the "altool" command line tool, but that is a little more annoying as the file is at this location in Xcode 12: /Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework/Versions/A/Support/altool
)
Special thanks to Derek Antrican for pointing this out.
Run the following in your terminal: xcrun notarytool store-credentials {PROFILE_NAME} --apple-id "{AppleID}" --team-id {TeamID}
. {PROFILE_NAME} can be whatever you like (but you will need to remember this later.) {AppleID} should match your Apple ID email, and {TeamID} should be your Apple Dev Team ID -- see step #20 (the TeamID is the same as the "Organizational Unit"). It will ask you for your app-specific password, so paste that in. You will use the {PROFILE_NAME} later.
Don't worry, you can re-use the app specific password and Developer ID cert for notarizing multiple applications!
macOS application packing is a paid feature in DotPurple. Please support us by purchasing a license! Once you purchase a license, you can register your software via a license key that will be emailed to you.
Note that you most likely want to check the "Self Contained" checkbox at the very least. By default, if you don't save any specific publish settings for your app in the selected profile, DotPurple will attempt to choose reasonable options for you.
Note that code signing does not work on apps that have been published with single file publish. This is a .NET 5 bug that will be fixed in .NET 6. See this GitHub bug report.
If you're going to distribute a DMG file, we recommend sindresorhus/create-dmg on GitHub. If you install that tool globally (npm install --global create-dmg
), your DMG creation command would be: create-dmg {AppPath} {OutputFolder} --identity="Developer ID Application: My Name (AAA4U1PBBB)" --overwrite
This will save your settings so that they will be automatically reloaded next time you use the software.
Now every time you want to distribute your app and build -> code sign -> notarize your app, you only have to change your Bundle Version and Bundle Short Version and then click one button ("Create .app file")! Hopefully, DotPurple has saved you hours of research and learning how the Apple notarization process works. 🎉
Visit our GitHub repository here and file a report under the Issues tab!