Skip to content

Packaging and Submitting an Electron App to the Mac App Store

Mark Lee edited this page Aug 12, 2016 · 5 revisions

Build The MAS App

The first step is to compile your application into an .app bundle. Notice that the --platform which you would normally expect to be "darwin" is instead "mas" to indicate this build is for the Mac App Store. Currenly only sethlu's fork supports the mas platform. The difference is that MAS builds ommit certain libraries and private API calls that will cause the electron app to be rejected.

Open terminal and CD to your application source directory. Run the following command:

electron-packager . "My App" --app-bundle-id=com.mysite.myapp --helper-bundle-id=com.mysite.myapp.helper --app-version=1.0.0 --build-version=1.0.100 --platform=mas --arch=x64 --version=0.36.7 --icon=path/to/your/Icon.icns --overwrite
Parameter Details:

The arguments are all documented, however below are additional details that apply specifically to building apps for the Mac App Store.

  • the dot "." is the path to your source code. In this case it assumes that your current directory is your source directory.
  • --app-bundle-id must match your Bundle ID that you assigned in iTunes Connect.
  • --helper-bundle-id is the same as your app-bundle-id with ".helper" prepended. Unless you have overridden the defaults for the helper bundle this value will be fine.
  • --app-version must match your Version Number in iTunes Connect.
  • --build-version the first two numbers must match the app-version (1.0.x). The third number can be any number that is larger than app-version's third number. It must be a unique number each time you submit a new build. For example, the first time submit a binary it is 1.0.100. If you make changes and submit another build, the third number must be incremented by at least 1 number, for example 1.0.101. You must increment the third number for each build that you submit.
  • --version refers to the version of Electron. At the time of this writing 0.36.7 is the most recent.
  • --ignore is a regex of files that you do not wish to package into your app bundle.
  • --icon is the path to the Icon.icns file that you created for your application.

Sign The App Bundle

If you have only one set of production certifications from iTunes Connect and your app does not have any special entitlements, then you can sign your app, allowing electron-osx-sign to automatically detect your certificates.

electron-osx-sign "My App-mas-x64/My App.app" --verbose
If you have packaged any additional binaries in your app:

If your app includes any additional binary files (command-line applications for example) then those binaries also need to be signed. You can specify additional binaries after the path to your .app bundle, but before the arguments:

electron-osx-sign "My App-mas-x64/My App.app" "My App-mas-x64/My App.app/Contents/Resources/app/bin/mybinary" --verbose
If you have multiple developer identities in your keychain:

electron-osx-sign searches your keychain for the first signing certificates that it can locate. If you have multiple certificates then it may not know which cert you want to use for signing and you need to explicitly provide the name:

electron-osx-sign "My App-mas-x64/My App.app" --identity="3rd Party Mac Developer Application: My Company, Inc (ABCDEFG1234)" --verbose

Create The Signed Installer Package

The final build step is to "flatten" your app bundle into an installer package. This .pkg file is what you will submit to the app store.

If you only have one signing certification then the following command will produce a signed installer package:

electron-osx-flat "My App-mas-x64/My App.app" --verbose
If you have multiple developer identities in your keychain:

Similar to osx-sign, osx-flat will auto-detect your signing certificate path. If you have multiple certificates then you will need to specify it:

electron-osx-flat "My App-mas-x64/My App.app" --identity="3rd Party Mac Developer Installer: My Company, Inc (ABCDEFG1234)" --verbose

Submit Your Installer Package to the App Store

You should now have a signed .pkg file in the same directory as your .app file. This is your installer package.

NOTE: It is important that you do not manually rename, or make changes of any kind to these files after signing them. If you need to rename files, do it before you sign them.

To submit your signed app you must use the Application Loader which is included with Xcode. You can open it using Spotlight, or by opening Xcode and going to the menu: Xcode > Open Developer Tools > Application Loader.

App Submission

Application Loader is simple to use. After you login using your Developer Program credentials, double click the "Deliver Your App" button. This will open a file chooser dialog which allows you to select your .pkg file that you created.

App Validation

Application Loader will first search your iTunes Connect account for a matching application based on the Bundle ID and Version Number. If a suitable application is found then it will display and allow you to continue.

After you choose to continue, Application Loader will perform validation on your application to ensure that everything is signed properly. If there are any problems they will be displayed for you to correct. Otherwise your binary will be submitted and ready for you to submit for review.

Congratulations!

You app is now submitted. Proceed to iTunes connect and ensure that all of the required information about your app has been completed. Your binaries will appear under the "Activity" submenu of iTunes and you will be able to click on the binary to "Select" it as the one you wish to release.

At this point you are ready to submit your app for review. With luck it will be approved and ready for sale!