How to create a pkg installer with a custom action?

I have created pkg bundle with pkgbuild & productbuild and I want to get the IP address from the User and that should be passed to postinstall script to write it in a specific file. I don't see any reference to do that. Can any one help me on this.


Ideally you want to avoid custom user interface elements within modern installer packages on macOS.

Where possible, fit your needs into the built-in options provided by the Installer. Alternatively, place the requirements into a supporting tool or first run sequence of any installed application.

Installer Plug-in

If you must use a custom Installer plug-in, the latest Xcode continues to include a template project to get you started. Know that this route will be expensive in terms of development time and effort; additionally it is unlikely to be supported in future versions of the operating system.

Create a new plug-in in Xcode using the menu item:

Xcode.app > File > Project… > macOS / Installer Plug-in

The project includes a template for you to customise. In particular, take a look at the source code of the InstallerPane class. The header file contains comments and insight into how to subclass the class.

Examples and Documentation

The plug-in tutorial by Stéphane Sudre looks like a great resource.

Another good resource is the Installer Developer mailing list archive.

Showing End User Licence Agreements

If you need to show an End User Licence Agreements (EULA) in your installer, use the built-in license entry in the package's distribution definition file.

Where more than one EULA is required, concatenate the licences into one document.