Dr Nic

ChocTop – packaging and deployment of Cocoa applications


I’m getting close to releasing a new Cocoa application, CommitChat, a sexy interface to having conversations for each commit in each watched project in GitHub. It was time to start thinking about packaging and distribution.

The result is a new project for all Cocoa developers, called ChocTop, and a 30-minute tutorial screencast on how to use it. ChocTop is to Cocoa apps what Hoe is to RubyGems; except prettier.

Packaging Cocoa apps

You can package and release Cocoa apps in a number of ways. Each app is actually a folder, so they need some packaging. Zip files are easy and the bonus is they auto-open when people download them. But for me, without a doubt, is the DMG packaging with a custom background image and the embedded symlink to the Applications folder, like the one for CommitChat below.

CommitChat DMG

I’ve always loved it. It made me as a user feel that this piece of software was special. A custom DMG is like a piece of magic.

Now like most magic, its really only magical when you don’t know how its done.

But there in lies a problem. You want to release your own Cocoa software with a beautiful custom DMG but you don’t want to know how to do it. You want the magic, even as a developer, but that means you can’t know how to do it.

And trust me you do NOT want to know how to do it. Ever.

Instead of writing a blog post about how to do it, what custom AppleScript you need, what special SetFile -a attributes you need to set, and what special file names you need to use, it seems more humane to not tell you. Ever. That’s a promise. It’s just that bad.

Introducing ChocTop

ChocTop packages and deploys any Cocoa application in a custom DMG, with generated Sparkle XML support.


On Vimeo | Download QuickTime Movie from Vimeo (275Mb, 640x480px)

Vimeo has slightly offset the video + audio after uploading. Grab the original movie file if its causing you grief.


ChocTop is a command-line installer plus rake tasks (watch the screencast if this is confusing), bundled
as a RubyGem:

sudo gem install choctop
install_choctop path/to/xcode/project

Your project is given a Rakefile, a releasenotes.txt and a releasenotes_template.html.erb

You edit the Rakefile with your custom DMG asset information and/or remote file locations for the rsync upload process. CommitChat’s Rakefile includes:

ChocTop.new do |s|
  s.host     = 'commitchat.com'
  s.base_url = 'http://commitchat.com/secret_path_to_beta'
  s.remote_dir = '/opt/apps/commitchat/secret_path_to_beta'

  s.background_file = "dmgbg.png"
  s.volume_icon = 'VolumeIcon.icns'
  s.app_icon_position = [106, 83]
  s.applications_icon_position = [422, 83]

You also need to add Sparkle to your project, and the Info.plist properties such as SUFeedURL.

To generate a new DMG, run:

rake dmg

To generate a new DMG and push it up to the remote server, and subsequently have users automatically start downloading the latest + greatest automatically via Sparkle:

rake dmg upload

I’m very sorry. It is perhaps too easy. It probably should be harder to make it seem more useful.

The very cool part is that when the DMG is being designed + constructed from your Rakefile settings you actually can see it happening on the screen. The AppleScript that is executed actually operates upon the DMG whilst it is mounted, before unmounting it, compressing and read-only-ifying it. Its pretty to watch.

More information

And a word from our sponsor

Dr Nic works at Mocra, a premier consultancy for Rails, iPhone and Cocoa development. We’re finishing some client projects soon and are available for new projects. Act fast!

Related posts:

  1. Instant new Rails applications with the App Scrolls When I start a new project I want to start...
  2. Unit Testing iPhone apps with Ruby: rbiphonetest Everything to love about Ruby: the concise, powerful language;...

23 Responses to “ChocTop – packaging and deployment of Cocoa applications”

  1. Very nice work. Thanks.

  2. RobC says:

    That looks pretty darn awesome. Absolutely going to have that in the tool-belt for whenever I actually get some desktop Mac apps done at some stage.

  3. This is nice, thanks! Do you have this hooked up to a post build script in Xcode, so you don’t even have to run the Rake command.

  4. Dr Nic says:

    @Duncan – we’re still toying with xcode integration.

    The rake dmg task does have an option so it doesn’t run the build step: rake dmg NO_BUILD=1 This may be useful. If you come up with a useful xcode integration idea, let me know. If you need choctop’s rake tasks to do something else, or some other feature, let me know via the ticket system.

  5. James Chan says:

    ChocTop is really awesome! Added to my app within minutes.

  6. Dr Nic says:

    choctop 0.9.6 now supports custom Applications icons:

    choctop with custom Applications icon love
    Uploaded with plasq‘s Skitch!

    Use the s.application_icon = “appicon.png” property

  7. This looks great! *drools*

  8. Roland says:

    Does this work to distribute e.g. JRuby applications as well?

  9. Dr Nic says:

    Roland, currently its focused on bundling cocoa apps with Sparkle integration. The custom DMG part should be reusable for generic assets, but I haven’t had a use for that yet so haven’t done it

  10. Ralph Manns says:


    I have done the xcode integration with shell script targets. One target for dmg, one for the feed and one for the appcast. The run scripts are rake dmg, rake feed and rake appcast. If I want the NO_BUILD=1 option, I can add it to the run script. Works perfect for me.

    Thanks to Dr Nic for the awesome ChocTop.

  11. [...] not the australian ice-cream. It maybe awesome too, I don’t know. I’m writing about Choctop the packing and deployment tool for Cocoa apps from DrNic. To work perfectly with my versioning [...]

  12. klip says:

    thanks dr nick this great

  13. pupsor says:

    Thank you for good project. It’s very useful and easy. Dr.Nik, I have one question about ChocTop: How can I start script after drag a program icon into Application folder? Sometimes I need install permissions or drivers and “run script after drag” could be better way to install perm/drivers. What do you think about?

  14. Dr Nic says:

    @pupsor, that might be a nice idea, though I’m not sure how to do it. The Applications folder is a pseudo-symlink (not even a real symlink).

    Your app might need to do the extra tasks when the person runs it the first time.

  15. pupsor says:

    Hello Nic! It’s me again ;) Now, I have a big problem with ChocTop. I’ve used Snow Leopard 10.6.1 and Xcode 3.2, but I can’t change coordinates of icon app/application. It looks like this:

    ps: I’ve tried download your example and check it, anyway – same problem, app/application icon didn’t change coordinates ;(

  16. Dr Nic says:

    @pupsor – hmm, perhaps SL changed the attributes or something. I personally don’t have SL installed yet. Hmm.

  17. Jose Lobato says:

    Hi Nic, pupsor,

    yes I experience the same problem. I’mt trying to discover the problem. No success so far.

  18. DrNic: On a cleanly installed Snow Leopard system (e.g. where other Ruby stuff hasn’t previously been installed) it appears one additional step is needed (install rubigen), like this:

    sudo gem install rubigen
    sudo gem install choctop
    install_choctop path/to/xcode/project

  19. Wouter says:

    I’m having trouble displaying a custom DMG background on Leopard systems when generating the DMG on a Snow Leopard system. The positioning of the icons work, it’s only the background that remains white when it should be a PNG. When opening the DMG on a SL system, this problem does not occur.

    I’ve been trying to change some of the AppleScript, but no luck so far. Anyone with the same problem?

  20. No Name says:

    I still have the following error on SnowLeopard 10.6.2 and xCode 3.2 :

    error: can’t exec ‘/Developer/Library/Xcode/Plug-ins/Clang LLVM 1.0.xcplugin/Contents/Resources/ccache gcc’ (No such file or directory)

  21. Gavin says:

    Really nice looking tool and informative screencast.


  22. Kim says:

    Howdy everyone! so I’m running SL 10.6.2 and xcode 3.2.1 and I’m also getting the icons in the dmg ignoring their positions in the rakefile… anyone ever solve this?

  23. Amit says:

    Please help me! new to cocoa and mac itself.
    I just tried the following command in terminal window on 10.5
    and getting following lines, please help me to setup choctop.

    i have also downloaded the drnic-choctop-v0.11.0-0-g3158f8f.zip, but not getting how to use that to install choctop.

    mac:~ as$ sudo gem install choctop
    Updating metadata for 1 gems from http://gems.rubyforge.org
    ERROR: could not find choctop locally or in a repository