This is a template for building .pkg installers for Omnis Studio-based projects on macOS.
- Your Omnis Studio-based application
- Packages
- A Developer ID code-signing certificate from Apple (required for code signing)
This example is build against Omnis Studio 8.0.2 but should work with any recent version of Omnis Studio.
Prepare a copy of your application in a folder other than /Applications
. The installer will be built from this copy.
Download or clone a copy of this repository. For example, this command will clone a copy of the project to a omnis-pkg
folder in ~/Documents
.
git clone https://github.com/barkingfoodog/omnis-pkg.git ~/Documents/omnis-pkg
Rename the Omnis.pkgproj
file to match your application. Open this file with Packages and edit these settings:
- Project -> Settings -> Name
- Project -> Presentation -> Title -> Distribution Title
- Packages -> Right-click Omnis -> Rename -> Enter your application name
- Packages -> [Your Package] -> Settings -> Tag -> Identifier -> Enter
com.[your company].pkg.[your application]
Replace the placeholder Omnis Studio Runtime with your application.
- Go to Packages -> [Your Package] -> Payload -> Contents -> Applications
- Right-click Omnis Studio Runtime 8.0.2 x64.app and Choose Delete...
- Confirm the delete
- Right-click Applications and choose Add Files...
- Select your source application
You can store the absolute path to your application or make it relative to the Packages files or its containing folder.
Change the permissions on the app to:
Read | Write | Exec | |
---|---|---|---|
Owner | X | X | X |
Group | X | X | |
Others | X | X |
Leave the Bit unset for all.
Edit the postinstall
script and set APP_NAME
and COMPANY_NAME
for your application. This will allow the script to set permissions and update the user's application data properly.
You can edit the preinstall
script to ensure your app is shutdown or make any other pre-requisite checks.
You can extend this script to make changes to the system after your app is installed. This script will be invoked with root privileges via sudo.
Edit the license.rtf
to add your own license agreement that will be displayed during installation.
In Packages, edit the Project -> Settings -> Exclusions list to exclude any files in your source application from the installer. For example, if you manage your installer in Subversion or git, exclude the .svn
or .git
folders.
You can add an introduction, read me, or other steps to the install process under Project -> Presentation. Review the Packages resources and linked sites for more information.
You can set minimum system requirements for running the installer under Project -> Requirements & Resouces. Double-click a requirement to edit it, and use the + and - buttons to add and remove additional requirements. This template is set to require:
- 2 GB RAM
- 1 64-bit Intel core
- macOS 10.9 and later
Open your .pkgproj file with Packages. Go to Build -> Build.
/usr/local/bin/packagesbuild -v "[path to your .pkgproj]"
Install your Developer ID private key and certificate on the build machine. Code signing takes an un-signed package file and creates a signed package file. If your package is omnis.pkg
, rename it to omnis_temp.pkg
.
# If you're automating this process, run this command to unlock the keychain so the Developer ID certificate can be accessed
security unlock-keychain -p "[your macOS user password]"
# Sign your temporary package with your Developer ID Installer certificate
productsign --sign "Developer ID Installer: [Your company name]" "[Your package]_temp.pkg" "[Your package].pkg"
# Verify the signature
spctl -a -v --type install "[Your packages].pkg"
A recent addition to Apple's security flow is the concept of notarizing your software. You can notarize your installer using the xcrun
command line tool by following this guide.
Pull requests are most welcome!