Well, its been a while since last post. I've been a bit busy as of late, but will make efforts to keep up the 'good work' of posting regularly. Anyway, I was working on my Alph project and needed a way to create OS X disk images from the command line that contained my source directories. The reason I needed to create a disk image (rather than a tar.gz file or something) was OS X holds data in the 'resource forks' of files. So, if you have directories that have OS X executables in them (not Unix executables, but OS X apps, etc) you need to maintain this data for it to be executable on another OS X machine.
I went round and round, but finally found that this simple command works great:
hdiutil create -fs HFS+ -volname DIR -srcfolder DIR DIR.dmg
Where DIR is the directory you want to create a disk image for. That's it! When the command returns you have a DIR.dmg file sitting in your current directory, and if you...
...the finder will mount it, and you can view it there, or in the Terminal:
Note: You don't have to name the volume the directory name, you can name it anything you want...the same goes for the .dmg filename.