How do I package a Mac OS application for install?

前端 未结 5 992
温柔的废话
温柔的废话 2021-02-01 02:31

I know on windows there are a bunch of installer tools you can use to create an installer, but on Mac OS I\'ve seen two ways to install apps:

  1. A DMG file which y

相关标签:
5条回答
  • 2021-02-01 02:48

    Try Iceberg! Another one package creator.

    0 讨论(0)
  • 2021-02-01 02:51

    We're discussing two things:

    • first and most importantly, the standard method by which the bits of an executable get laid on the disk in a way that's accessible and properly registered by the system
    • second, the mechanism for preparing the .app, as recommended by Apple

    An older marketing page on Apple's site says it's recommended to create packages (so the Installer application can move the bits in place) with the PackageMaker application. Its usage is described here: mactech.com/articles/mactech/Vol.25/25.03/2503MacEnterprise-PackagingforSystemAdministrators/index.html.

    But as others have mentioned, the elephant in the room is the MacAppStore(MAS for short). Until it's debut, what was standard for large companies was their own custom scripts rolled into an older-style 'bundle' package or using an executable like the VISE installer. Smaller developers usually tried to make their app installable via drag-drop, distributed in zip archives or disk images(for simplicity's sake). The MAS is different: as of 10.7 it uses a package format (which debuted in 10.5) referred to as a flat package (really a xar archive, explanation here) which is transferred over http to a hidden folder, installs directly to Applications(after which the temporary folder it is downloaded to is deleted). It drops its receipt and a bill or materials file into /private/var/db, and is therefore audit-able by the built-in command line pkgutil tool, described here: mactech.com/articles/mactech/Vol.25/25.12/2512MacEnterprise-PackagesReceiptsandSnow/index.html

    A benefit of using the flat package format is you can pull things over the network more safely and efficiently, but it isn't as easy to work with as bundle packages if you are testing and modifying the package regularly, or iterating to ensure scripts that perform actions or checks work well. Even when flat, putting the pkg in a archive or disk image is recommended for flexibility. More distribution tools expect DMG's than zip's, so there's that as well.

    Besides what Apple recommends and what is standard, common practice, there's this article: https://www.afp548.com/2010/06/03/the-commandments-of-packaging-in-os-x/ which discusses the why's and hows (although mainly for system administrators) of packaging for wider distribution. It is greatly recommended to get more of a feel of how and why things go wrong, and what to avoid.

    0 讨论(0)
  • 2021-02-01 02:53

    Packages works well. If your deployment process must be kept simple, it is great.

    The Quick build consists of dragging your .app onto Package and it is done.

    For advanced packaging, you can also provide a certificate.

    http://s.sudre.free.fr/Software/Packages/about.html

    0 讨论(0)
  • 2021-02-01 02:59

    In OS X, many applications are just created as a Relocatable application bundles that the user just need to copy to the /Application folder (or any other location). In other cases, when you need to perform some operations over the machine (such as adding users or changing permissions) you can use a PKG installer (for example built using PackageMaker), which allows executing some pre and post install scripts and support some basic installation configuration, like selecting the installation drive.

    Sometimes, as with complex server software, you need more flexibility, for example to show custom pages to the end user requesting information required to install your application, like the MySQL port and password or proxy information to download requirements on the fly (or simply to make it look fancier :)). For this cases there are other installer solutions like our BitRock InstallBuilder (disclaimer, I'm one of the developers). InstallBuilder also has the advantage of generating multiplatform installers using the same project with very little customization per platform.

    0 讨论(0)
  • 2021-02-01 03:01

    Apple is very clearly making the "standard" to be downloading a program from the App Store. This has the benefit of making application installation transparent to the normal user. And, believe it or not, normal people have a lot of trouble with the concept of installing a program. Of course that benefit comes with some costs, but this isn't the place for that debate–there are plenty of other places for that.

    Assuming you don't want to or can't go the App Store route, both PKG and DMG are common ways to distribute a program. Use a PKG if you need to install files aside from your application bundle (which should not be a common use case). In all other cases use a DMG that prompts the user to copy the application into the Applications folder. But a lot of your users will not understand that they need to do that (unless your target audience is solely knowledgeable computer users). They will run your application from the disk image. Ideally in this case, your program will detect that it is running from a disk image and offer to copy itself into the Applications folder.

    0 讨论(0)
提交回复
热议问题