ChocTop – packaging and deployment of Cocoa applications

Posted by Dr Nic on February 03, 2009 and blessed with 21 comments

ChocTop

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.

Screencast

On Vimeo | Download QuickTime Movie from Vimeo (275Mb, 640×480px)

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

Instructions

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]
end

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. Unit Testing iPhone apps with Ruby: rbiphonetest Everything to love about Ruby: the concise, powerful language;...
  2. Using Ruby within TextMate snippets and commands I didn’t know you could run Ruby within TextMate snippets....
Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

  1. Greg Furmanek Tue, 03 Feb 2009 08:26:33 UTC

    Very nice work. Thanks.

  2. RobC Tue, 03 Feb 2009 08:28:51 UTC

    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. Duncan Robertson Tue, 03 Feb 2009 19:29:23 UTC

    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 Tue, 03 Feb 2009 20:02:11 UTC

    @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 Wed, 04 Feb 2009 01:26:30 UTC

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

  6. Dr Nic Tue, 10 Feb 2009 17:13:17 UTC

    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. Alistair Holt Tue, 17 Feb 2009 11:02:39 UTC

    This looks great! *drools*

  8. Roland Thu, 19 Feb 2009 06:30:29 UTC

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

  9. Dr Nic Thu, 19 Feb 2009 12:27:48 UTC

    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 Sat, 21 Feb 2009 08:39:22 UTC

    @Duncan

    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. Ralph’s Blog - ChocTop is awesome! Sat, 21 Feb 2009 09:31:28 UTC

    [...] 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 Mon, 07 Sep 2009 08:17:24 UTC

    thanks dr nick this great

  13. pupsor Thu, 24 Sep 2009 11:55:37 UTC

    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 Thu, 24 Sep 2009 15:22:40 UTC

    @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 Wed, 30 Sep 2009 02:30:41 UTC

    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 Wed, 30 Sep 2009 08:12:57 UTC

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

  17. Jose Lobato Tue, 13 Oct 2009 04:56:09 UTC

    Hi Nic, pupsor,

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

  18. Gary W. Longsine Thu, 15 Oct 2009 07:13:35 UTC

    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 Fri, 30 Oct 2009 01:50:11 UTC

    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 Sun, 15 Nov 2009 23:57:10 UTC

    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 Mon, 30 Nov 2009 03:10:38 UTC

    Really nice looking tool and informative screencast.

    Cheers.

Comments