Installation Q & A
Q
Are there some advanced features in Packages I may have missed?
A
Some features are only available when you turn on the Advanced User Options mode and other features are only useful in very specific cases so you might be unaware that they exist. This article will list all those features and explain you how to turn on the Advanced User Options mode.

Turning on the Advanced User Options mode

Turning on the Advanced User Options mode is easy and will reveal new options in the user interface of Packages.

  1. Open Packages.
  2. Choose Packages > Preferences….
  3. Click Advanced.
  4. Click the Show Advanced User Options checkbox.

When the Advanced User Options mode is on, you should have access to the following new options in the user interface:
Project Type
PaneFeature
Distribution
Project > SettingsAdvanced Options
Distribution
Project > Presentation > LicenseCustom License Template
Distribution

&

Raw Package
Package > SettingsHFS+ compression
Package > PayloadBuild Options
Elastic Folders
Destination name

Advanced options for distribution projects

The advanced options for the settings of a distribution project lets you edit options that are useful in a limited number of cases. You can find a list of these options in the Packages documentation.

There are 3 main cases where you may need to use theses advanced options:

  1. You want to restrict the installation to the home folder of the current user.
  2. You want the version of the main component of your distribution to be visible in the Software > Installations list in the System Information.app application.
  3. You want to prevent the Rosetta alert from appearing during the installation of the distribution on an Apple Silicon based Mac.
Restricting the installation to the home folder of the current user

This topic is covered in the Q&A 03 article.


Displaying the version of the main component in the Software > Installations list of the System Information.app

By default, after you have installed a .pkg distribution, only the name of the distribution is displayed in the Software > Installations pane of System Information.app.

You can use the 'product' advanced option to make the version of the main application/component be visible in that pane.

  1. Open Packages.
  2. Open your .pkgproj distribution project.
  3. Choose the Project item in the source list.
  4. Click the Settings tab item.
  5. Type the bundle identifier of the main application/component of the distribution in the product id cell.
  6. Type the version of the main application/component of the distribution in the product version cell.

Preventing the apparition of the Rosetta alert during the installation

The 'hostArchitectures; advanced option can be used to define which architectures (PowerPC, Intel, Apple Silicon) are supported by a distribution.

By default, when the 'hostArchitectures' advanced option is not set, the distribution is assumed to support the PowerPC and Intel architectures. So if you install the distribution on an Apple Silicon based Mac, macOS will strongly suggest to install Rosetta to translate the Intel instructions to ARM ones.

If you know that the binaries in the payloads and additional resources, and the installer plugins support the Apple Silicon architecture:

  1. Open Packages.
  2. Open your .pkgproj distribution project.
  3. Choose the Project item in the source list.
  4. Click the Settings tab item.
  5. Type "arm64 x86_64" in the options > hostArchitectures cell.
This will prevent the Rosetta alert from appearing.


Starting with Packages 1.2.10, in most cases, you won't have to do this as Packages will determine during the build process which architectures are supported by all the binaries and Installer Plugins in your distribution.

You may still want/need to set the value manually for complex cases such as a distribution with a package for the Intel architecture only and another one for the Apple Silicon architecture only and with OS requirements determining which one will be installed.


Custom license template for distribution presentation (requires Packages 1.2.10 or later)

When the advanced options are on, the Presentation editor will allow you to select a custom license template in additions to text files and license templates.

  • A custom license template shares the same properties as the default license templates (APSL, Artistic, BSD, etc.) of Packages.
  • A custom license template is a bundle document using the .pkglic extension.
  • The bundle contains one more localizations of the End User License Agreement (EULA) as RTF file(s).
  • The EULA can include keywords that can be replaced with custom values using Packages user interface.

Check the Packages License.pkglic document used by Packages to see an example of a custom license template.


Choosing a custom license template in Packages

  1. Open Packages.
  2. Open your .pkgproj distribution project.
  3. Choose the Project item in the source list.
  4. Click the Presentation tab item.
  5. Click the License step.
  6. Choose "Choose a Custom License Template…" item in the Inspector popup button.
  7. Select a .pkglic document in the standard open panel.
  8. Click Choose.
  9. Set the values for the keywords if needed.


HFS+ compression for payload archive

This feature is only useful for macOS 10.6 (and later) devices when the targeted volumes is formatted in HFS+.


Build options for payload archive

There are 3 advanced options:

  • Split Forks if needed: This option is enabled by default. It will preserve the resource fork (if there is one) of a file so that it is restored during the installation of the payload.
  • Preserve extended attributes: This option is disabled by default. This option is a sub-option of the Split Forks if needed option. In addition to preserving a potential resource fork, it will also keep the extended attributes of a file so that they are restored during the installation of the payload.
  • Treat missing files as a warning: This option is disabled by default. If you enable this option, if a file or folder listed in the payload hierarchy is missing when you build your package, it will not stop the build and the missing file will only be reported as a warning and not an error.


Elastic folder in payload hierarchies (requires Packages 1.2.10 or later)

Elastic folders are similar to custom folders. The difference is that the name of an elastic folder can include '/' characters.

As you probably already know, '/' is the path file separator on macOS. And as you may have guessed, this allows an elastic folder to represent a series of enclosed folders.

For example, an elastic folder named "myFolder/mySubfolder" will be transformed to a folder named "myFolder" that contains a folder named "mySubfolder" inside the payload archive of your installation package.

The name of an elastic folder (or a custom folder) can be set to a user defined settings. See User defined settings to learn more about this.


Destination name for filesystem items in the payload

Let's say the payload of your package needs to include a configuration text file whose name is '.configuration'.

Adding this file to the payload hierarchy can be annoying as files starting with '.' are by default invisible in the Finder and the standard open panels.

To show this file in the open panels of Packages, you can:

  1. Open Packages.
  2. Choose Packages > Preferences…
  3. Click the Files item in the toolbar.
  4. Check the Show all files in dialog box.
You can also use the cmd + shift + . shortcut in the open panel.

The remaining problem is that it's still annoying to edit that file as it is still not visible by default in the Finder and your favorite text editor will by default not show the file in the standard open panel (unless you use vi or emacs).

Enters the destination name. It is possible in Packages to set a destination name for a file system item. This name will be the one the file/folder will have in the payload archive of the installation package. This way, the name of you configuration text file can be 'configuration' and its destination name can be '.configuration'. You will be able to add it easily to the payload hierarchy and edit this file with your favorite text editor.

To set a '.configuration' destination name for a file named configuration:

  1. Open Packages.
  2. Open your .pkg project.
  3. Show the Payload pane of the package.
  4. Add the 'configuration' file to the payload hierarchy.
  5. Select the 'configuration' item in the payload hierarchy.
  6. Control + click the item.
  7. Choose Set Destination Name.
  8. Type '.configuration' and validate with the Return key.
You can remove the destination name by choosing Reset Destination Name in the contextual menu.

The destination name can be set to a user defined settings. See User defined settings to learn more about this.


User defined settings (requires Packages 1.2.10 or later)

User defined settings let you use keywords inside or instead of the string values used for the settings of your Packages projects. You can then define a default value for each keyword.

A keyword is a string that looks like this: ${keyword}.

Here's an example to illustrate how this can be useful:

  • A distribution project with an OS requirement to prevent installing it on macOS version earlier than 10.14.
  • Localized error messages are defined for this requirement.
  • Each localized message contains the "10.14" string to inform the user about the required minimum OS version.

If a new version of your product requires macOS 10.15 or later, you will need to edit each localization of the error message.

With user defined settings, you can have a user defined setting named MIN_OS_VERSION and then replace each occurrences of "10.14" in your error messages with ${MIN_OS_VERSION}. You can then define the value of MIN_OS_VERSION to be "10.14".

When you need to bump the minimum OS requirement for your distribution project, you now just need to change the value of the MIN_OS_VERSION user defined settings.

If you are building your projects using the packagesbuild command line tool in a build script, you can also set the values of user defined settings using arguments.

For instance, here's an extract of the build.sh script to build the installation package for Packages.

#!/bin/sh

[...]

# Retrieve the version

VERSION="1.0"

if [ -f distribution/Version ];
then

	VERSION=`cat distribution/Version`

fi

# Get the current year

CURRENT_YEAR=`date "+%Y"`

[...]

/usr/local/bin/packagesbuild --verbose \
                             --project Packages.pkgproj \
                             DISTRIBUTION_PRODUCT_VERSION="${VERSION}" \
                                       COPYRIGHT_END_YEAR="${CURRENT_YEAR}"

[...]

The .pkgproj for Packages includes 2 user defined settings:

  • DISTRIBUTION_PRODUCT_VERSION used for the product version advanced option.
  • COPYRIGHT_END_YEAR used for the YEAR keyword of the custom license template for the project.

This way, no need to to manually update the copyright each year. And the product version for the distribution will always match the version used in the .app.

The list of settings that support user defined settings is available in the user guide.

Site Map

Copyright 2021-2022 Stéphane Sudre. All rights reserved.