17

How can I create a single installer package for an OS X binary as well as a few configuration and script files?

Final folders should look like this:

https://i.stack.imgur.com/bFDcY.png

Any help would be appreciated. Thanks.

3 Answers 3

18

Installers are great if you want various things to be placed in different spots – app here, documentation there, support files over here, etc. They're also great for providing configurability of the installation experience (optional extras), or hand-holding for an unusual type of installation that the user might not otherwise understand, or extra work (configuration scripts, permissions modifications, authentication, compatibility checking, etc.) that need to run during the installation process. There is nothing wrong with installers, contrary to the answer from @d00dle, although there is also nothing wrong with distributing your app through the App Store, or as a dmg.

For setting up your own installers, I highly recommend a program called Packages (http://s.sudre.free.fr/Software/Packages/about.html). I am in no way connected to it, but I use it to build the installer for an app that I work on. It greatly smoothes the process of making a complex installer, and has an excellent GUI interface.

8
  • The problem with Packages, also Iceberg, is we can't add folder, only files, so if we have multiple sub-folders with multiples files.. we need to add folder one by one !
    – Saif
    Jul 1, 2018 at 0:46
  • 1
    This is not true. I just added a folder full of files to a Packages build without issue. Oct 23, 2018 at 19:43
  • 8
    I'd never rely on third party tools when there are buildt-in utilities to do the job in a clean way. On macOS those are pkgbuild and productbuild.
    – Bachsau
    Mar 7, 2019 at 0:40
  • 1
    Well, that's just, like, your opinion, man.
    – bhaller
    Apr 20, 2021 at 18:09
  • 1
    @HughPerkins that is an issue with code signing and/or notarization. The package is probably fine, it just isn't trusted by Apple because it isn't signed/notarized. Typically, you can right-click on the package and choose, in the resulting context menu, that you want to open the package, and after warning you, macOS will then allow you to proceed. If you want to actually get rid of the warning, you'll have to delve into signing/notarization, which is a somewhat separate and complex topic, but the documentation for Packages does have some useful things to say about it; beyond that, Google.
    – bhaller
    Dec 11, 2021 at 19:12
4

There's also macOS Installer Builder, which is a CLI you can use to create an installer wizard for your .pkg: https://github.com/KosalaHerath/macos-installer-builder

1
  • 1
    That was super helpful. The link in the GitHub repository medium.com/swlh/… was awesome. Step by step guide on how to do it. Thanks again! Jul 4, 2021 at 17:17
-4

macOS does not normally use installers. Applications are packaged in app containers with the extension .app. This container is "executable" but you're also able to dig in and see what is inside. This is also the format distributed through App Store.

You can create .pkg or .dmg "installers" if necessary, however this is clearly not something apple aims to be standard. I would advise to use the .app pattern and any scripts needed should be self contained and executed on first run.

You can use .dmg to distribute your application outside of App Store (this is still fairly normal).

macOS also includes a terminal program called productbuild that builds a product archive for the macOS Installer or the Mac App Store. Enter man productbuild into the Terminal on a Mac for the manual page.

3
  • 13
    This is the wrong answer. .pkg is the standard installer, and should be used for anything that needs to be more than in the /Applications folder. Packages is a freeware app to build a pkg file. Oct 23, 2018 at 19:42
  • 4
    This is outright wrong. .pkg files are very common for use with big software applications and even though the self contained .app files may be viable for small applications, it is extremely common for developers to use a .dmg to provide a drag-and-drop copy installation for the file.
    – NBTX
    Aug 9, 2019 at 16:18
  • 1
    While this answer isn't answering the question as asked, I have to disagree with the comments that say it is wrong. While .pkg is standard, .app clearly is and should be the default choice. (And it's likely the correct choice for the OP.) Desktop programs should be self contained apps whenever possible. Packages are for things that need greater OS integration or other unusual setup steps and can't be done with a simple app. It's something you do when you have to, not because you choose to. Apr 1, 2021 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.