Search code examples
macospackagepkgbuild

Adding files in creating pkg in mac os x


How can I include files needed by preinstall/postinstall scripts when creating .pkg in mac osx?

I have performed this command in the terminal and have generated .pkg; however, nothing happens when I double click the generated .pkg file.

pkgbuild --root ./files --scripts ./scripts --identifier com.example.myapp --version 1 --install-location /Applications mypackage.pkg

where: /files (contains necessary files for preinstall/postinstall scripts) and /scripts (contains preinstall/postinstall scripts)


Solution

  • Add the files to a folder in the build, which gets copied to the user's machine. If you don't want to leave the files after installation, your post install script can delete them.

    I currently use the following command: -

    pkgbuild --identifier com.company.product --version 0.1 --scripts scripts/ --root ProductNameInstall/ "mypackage.pkg"
    

    The source files to be copied reside in the folder ProductNameInstall.