开发者

Packaging a Mac app for distribution [closed]

开发者_运维知识库Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 8 years ago.

Improve this question

What's the preferred way to create a distributable file for Mac OS: dmg or pkg?


Regarding the disk image (DMG) approach, typically this is implemented in a way that makes obvious to the user that they need to drag the app over to their /Applications folder. (Sometimes this is done with a pre-existing alias of the /Applications folder next to the app icon on the DMG, and then a background image that has an arrow between them or text instructions overlaid that explains what to do.) Too often, though, users just double-click the app and run it from the disk image, which gets confusing (what if they eject the disk image? what happens next time they try to run the app?)

Alexander Limi, one of the Mozilla Firefox developers, has two great articles about getting your OS X app to detect when it's being run from the installer disk image, and then offering to copy itself to the /Applications folder.

  • http://limi.net/articles/improving-the-mac-installer-for-firefox/
  • http://limi.net/articles/firefox-mac-installation-experience-revisited/

It's an approach that's now accepted enough to have generated at least one code class, M3InstallController, to enable the behavior in your own app. The developer of another OS X app that takes this approach released his own code example, as well.

So if you go the route of a disk image with an app that needs to be dragged into the /Applications folder, strongly consider detecting whether the user is running the app from the disk image, and offer to move it for them! Your users, and your support folks, will thank you. :)


I don't think there's a fixed answer. If you just have an application bundle, I think most end-users expect a DMG. But if you're installing a menu extension -- or anything else that would need to be in a Library directory, you'll usually need a pkg file.

I've used both for different types of installs. They both work. As long as you use one of these two (and not some type of wacky install script), people will be happy IMHO.


Advantages of zips:

  • Safari auto-unzips
  • Easy to create
  • Easier to use with Sparkle updater

Advantages of dmgs:

  • Can be used to display a license aggrement
  • Can display install instructions (DMG Canvas)

Don't use .pkgs unless you need to place your bundle in a certain location. (WebKit bundles, Kernel extensions...)


The trend for Mac apps is a nice DMG with a drag-installable application on it. Or maybe even just a ZIPped application that knows how to copy itself to the user's Applications directory when launched.

Don't use an installer unless you absolutely have to.


Disk image if installing is as simple as drag-and-drop, package installer if you need to install supporting files outside of the app bundle.

Also note that with a disk image, it's a good idea to offer to install the app for the user if they run the program from the image. Otherwise some people will never actually install the program and just keep the disk image around forever.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜