homebrew-cask/doc/cask_language_reference/stanzas/pkg.md

2.8 KiB
Raw Blame History

pkg

This stanza must always be accompanied by uninstall

The first argument to the pkg stanza should be a relative path to the .pkg file to be installed. For example:

pkg 'Unity.pkg'

Subsequent arguments to pkg are key/value pairs which modify the install process. Currently supported keys are allow_untrusted: and choices:.

pkg allow_untrusted:

pkg allow_untrusted: true can be used to install the .pkg with an untrusted certificate passing -allowUntrusted to /usr/sbin/installer.

This option is not permitted in official Homebrew-Cask taps, it is only provided for use in third-party taps or local Casks.

Example (alinof-timer.rb):

pkg 'AlinofTimer.pkg', allow_untrusted: true

pkg choices:

pkg choices: can be used to override .pkgs default install options via -applyChoiceChangesXML. It uses a deserialized version of the choiceChanges property list (refer to the CHOICE CHANGES FILE section of the installer man page for further information).

Running the macOS command:

$ installer -showChoicesXML -pkg '/path/to/my.pkg'

will output an XML which you can use to extract the choices: values, as well as their equivalents to the GUI options.

See this pull request for wireshark-chmodbpf and this one for wine-staging for some examples of the procedure.

Example (wireshark-chmodbpf.rb):

pkg "Wireshark #{version} Intel 64.pkg",
    choices: [
               {
                 'choiceIdentifier' => 'wireshark',
                 'choiceAttribute'  => 'selected',
                 'attributeSetting' => 0,
               },
               {
                 'choiceIdentifier' => 'chmodbpf',
                 'choiceAttribute'  => 'selected',
                 'attributeSetting' => 1,
               },
               {
                 'choiceIdentifier' => 'cli',
                 'choiceAttribute'  => 'selected',
                 'attributeSetting' => 0,
               },
             ]

Example (wine-staging.rb):

pkg "winehq-staging-#{version}.pkg",
    choices: [
               {
                 'choiceIdentifier' => 'choice3',
                 'choiceAttribute'  => 'selected',
                 'attributeSetting' => 1,
               },
             ]