Let’s Build our macOS InstallerFirst, you need to clone macOS installer builder repository your machine and then add needed configurations to it.
After that, you only need to run the command to build your application’s installer.
Let’s start our journey.
Clone macos-installer-builder repository to your local machine.
You can clone the repository by the following command.
Let’s define the repository’s home as <REPO_HOME>.
git clone https://github.
Copy your application’s distribution files (which you need to be copied after the installation) to application directory which located at:<REPO_HOME>/macOS-x64/applicationAs an example, I downloaded WSO2 API binary distribution and unzipped.
Then copied all the files to ‘application’ directory.
WSO2 API Manager’s distribution copied to the application directory3.
Modify the following files with your application's information.
You can find these resource files in the following location.
html :Welcome page of the installer can be defined by this HTML file.
I have modified it for WSO2 API Manager.
html :This file contains the conclusion file’s HTML design and you can change it as you wish.
I change this file using WSO2 API Manager details.
png :Add an image of your application’s logo after renaming as banner.
I added WSO2 API Manager logo as this file.
Add your need modifications to the post-installation script file.
This script will run automatically after the installation and you can add your needed functionalities to this file.
The file is located at:<REPO_HOME>/macOS-x64/darwin/scripts/postinstallAs an example in my postinstall file, I added a shortcut creation function which creates a shortcut to my application’s executable file.
In WSO2 API Manager, we need to run wso2server.
sh file to start the server.
Therefore, in this example, it will create a command line shortcut to wso2server.
sh file and you can start the WSO2 API Manager server following command.
You can set the following parameter to your application distribution’s executable file and create a shortcut.
Run the following command to build your macOS installer.
sh [APPLICATION_NAME] [APPLICATION_VERSION]Note: You should provide an application name and application version.
In addition, application version should be [0–9].
( Example: 2.
0 )This will start the installer generating process ( 3-step process) and after two progress it will ask your preference on installer signing.
Please refer this section for more details on installer signing.
If you have an Apple Developer Installer Certificate issued by the Developer ID Certification Authority of Apple you can sign your installer by giving you certificate ID.
If you wish to create the installer without signing you can skip that step.
( You need an internet connection to sign the installer)Provide the Apple Developer Installer Certificate IDAfter the successful three steps, the macOS installer builder will create .
pkg file of your application on the following location:Signed Package:<REPO_HOME>/macOS-x64/target/pkg-signed/Un-signed Package:<REPO_HOME>/macOS-x64/target/pkg/Bravo!!.????That’s it.
Now you can start the installation process by clicking the .
⚙ Installation ProcessInstallation process steps are given below:Page 01: Welcome page (change the content using welcome.
html file)Page 02: Destination selection page (Can not change the content but can disable the page from the Distribution filePage 03: Storage Size Analyzer (Can not change the content)Page 04: Conclusion Page (Can change the content using conclusion.
html)After the installation, your application’s distribution files will be copied to the following location: (You can change this path also by changing build-macos-x64.
sh file)/Library/<APPLICATION_NAME>/<APPLICATION_VERSION>/????.Uninstallation ProcessYou can easily uninstall the application by running the uninstall.
sh script that will be located at,/Library/<APPLICATION_NAME>/<APPLICATION_VERSION>/In addition, you can add more functionalities to the uninstall.
You only need to add these tasks to the following file before you generate the installer.
(As an example I added a function to delete the application shortcut after the installation).
sh????.Mac Developer ID Certificate Guide Add Developer Id CertificateIf you do not have a signing certificate get a Developer ID Installer Certificate (Mac applications) from Apple Developer Web Site.
Open Keychain Access tool on your Mac machine.
File → Import Items and select the key you downloaded from Step 1.
Enter the password of the key where necessary and you will have to provide your password to access the keychain of your machine.
pkg filesRun the below command to sign the .
pkg fileproductsign –sign "Developer ID Installer: <CERTIFICATE_NAME_AND_ID>" <INSTALLER_NAME>.
pkgTo verify the signed .
pkg file run the following command:pkgutil –check-signature signed/<SIGNED_INSTALLER_NAME>.
pkgYou will see an output with SHA1 fingerprint after the above command if the .
pkg file’s sign validation is successful.
So, You can use this automated macOS installer builder to easily generate installers for your any application that can be run on macOS.
Please suggest any modifications that will improve the macOS installer builder to here.
Cheers!!.????????More details on command-line package building tools :OS X: Creating Packages from the Command Line – Tutorial and a Makefile – Part IOver the years Apple has been removing useful tools from its flagship IDE, XCode, and PackageMaker was one of them.