DMG
A Flutter package that helps you create, sign, notarize, and staple a .DMG with a single command.
Features
- Easy to use: Streamline the entire process with one command.
- Security: Ensures your .DMG files are signed and notarized as per Apple's requirements.
Requirements
All these steps are needed only for the first app. You can reuse these settings in other apps.
Before installation, ensure you have the following
- Python (version 3.x or later)
- Flutter
- Xcode (for macOS)
Install dmgbuild
if you haven't (documentation)
pip install dmgbuild
Create a NotaryProfile
1. Go to App Store Connect -> Users and Access -> Keys.
2. Click (+) to generate a new API key, input a Name (normally use NotaryProfile
) and Access (normally use Admin
).
3. Download the generated file and save it somewhere secure. Also, note the Issuer ID
and Key ID
.
4. Open the terminal and run xcrun notarytool store-credentials
. Input all the above data, ensuring the name is input as NotaryProfile
.
Create a Developer ID Application
certificate if you don't have one
1. Open Xcode.
2. Go to Xcode
-> Preferences
-> Accounts
.
3. Click Manage Certificates...
-> Click (+) -> Choose Developer ID Application
-> Click Done
.
Usage
Add this package to your development dependency:
flutter pub add --dev dmg
Open a terminal in your current project, then run:
dart run dmg --sign-certificate "Developer ID Application: Your Company"
Sometimes, it is necessary to add two spaces between the words "Your" and "Company" like "Your Company".
Change the notary profile name if you haven't used the default by adding:
--notary-profile "NotaryProfile"
If you want to add a license (a window will show up asking for acceptance before showing the installation for the .dmg), add this line to the above code:
--license-path "./path/to/license.txt"
You can also add your own settings.py
from dmg-build by adding:
--settings "./path/to/settings.py"
Note that the --license-path
will be ignored when you use your own settings.py
.
Your output DMG
is expected at build/macos/Build/Products/Release/<name>.dmg
.
Contributions
This package is still in the early stages. File an issue if you have one, and PRs are welcome.