tags:

views:

2138

answers:

4

Is it possible to build a .dmg file (for distributing apps) from a non-Mac platform? And if yes, how?

+5  A: 

If you're distributing Mac apps, then surely you have a Mac to write and test them. Why not simply use that same Mac to create the disk image?

[Edit] Alternatively, if you're distributing a portable app, for example a Java .jar file, why bother with a disk image? Macs understand .zip and .tar.gz archives just fine.

I guess what I'm getting at is, I don't understand how one might need a DMG disk image, but not have a Mac with which to create it.

Sherm Pendley
He hasn't said he doesn't have a Mac. I could imagine a build environment where all other platforms are prepared on one system (with cross-compilers, say) and he wants to build the Mac distro there, too.
Rob Kennedy
The tools to build for a platform are typically specific to that platform. I would no more expect to build Windows installers on a Mac than I'd expect to build Mac disk images on Windows.
Chris Hanson
Actually, several people build Windows installers on Linux, and I believe the same tools also work on a Mac. Such is the magic of cross-compiling: a single machine can build for all the targets.
CesarB
+3  A: 

It does seem possible to create DMG files with some third party tools. A quick google search reveals at least a few commercial tools:

Not sure about any OSS/freeware options, but it does at least seem possible if you are so inclined.

Edit: I also forgot about MacDrive, which is another great tool for working with HFS+ filesystems under windows. Since a DMG is basically just a HFS+ filesystem snapshot, it is probably possible with MacDrive to create DMG's as well.

Nik Reiman
You should also be able to do it using command line tools under Linux, similarly to how one would create a DMG from the command line on Mac OS X.
sascha
+2  A: 

See mkfs.hfsplus

Josh
+3  A: 

Yep, mkfs.hfsplus does it.

dd if=/dev/zero of=/tmp/foo.dmg bs=1M count=64
mkfs.hfsplus -v ThisIsFoo /tmp/foo.dmg

This creates a dmg file (in this case 64M) that can be mounted on a mac. It can also be mounted on linux, with something like

mount -o loop /tmp/foo.dmg /mnt/foo

after wich you just copy the content you want to it (in /mnt/foo). Unmount it, and the dmg can be copied over to a mac and mounted there.

jstck