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.
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.
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.
ChocTop packages and deploys any Cocoa application in a custom DMG, with generated Sparkle XML support.
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] end
You also need to add Sparkle to your project, and the Info.plist properties such as
To generate a new DMG, run:
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.
- Homepage – http://drnic.github.com/choctop
- Source – http://github.com/drnic/choctop
- Tickets – http://drnic.lighthouseapp.com/projects/24673-choctop
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!
- Instant new Rails applications with the App Scrolls When I start a new project I want to start...
- Unit Testing iPhone apps with Ruby: rbiphonetest Everything to love about Ruby: the concise, powerful language;...