Eric Roller's Development Blog

Splitting Disk Images

- Posted in General by

This has been bugging me for a while: How do you split large .dmg files such that you can save them onto multiple CDs (as opposed to an expensive DVD). It turns out, there is no special tool required (although it would be nice if Disk Utility would do the job). No, the functionality is already built-in in the Mac OS. All you need to do is to use the hdiutil in the Terminal to create your partitions:

% cd Downloads
% mkdir parts
% hdiutil segment -o ./parts/large_image.dmg \
    -segmentSize 100m large_image.dmg

Of the resulting files in the parts directory, one can simply double-click the first one in the Finder to mount the entire image:


A not very well documented error message which occurs right at the beginning of the build, typically during compilation of the prefix file. The error is found in a derived file, for instance:

.../EnterMordor.build/DerivedSources/EnterMordor_vers.c:1: error: parse error before ';' token:

[...] const double EnterMordorVersionNumber __attribute__
((used)) = (double);

Observe that there is no valid argument after the equal sign. To find the cause, we must know that derived files are based on our build settings. In my case, the fault lies in the fact that the built setting VERSIONING_SYSTEM is set to apple-generic, but I was missing is a setting for the CURRENT_PROJECT_VERSION variable.

See also Xcode: Help -> Show Build Setting Notes -> Versioning.

According to Chris Hanson's article, the apple-generic versioning system uses agvtool to auto-update all Info.plist files. Also, there will be a TargetVersionString and a TargetVersionNumber variable available to your code. Right now, I you do not like or need all that, so I simply set the versioning system to "none" and continue to manually update the CFBundleShortVersionString and CFBundleVersion settings.

Using a popup menu to allow the user to select the (integer) value of an object can be easily done through binding the selectionIndex. However, what if you wanted to launch an update method when the selection changes, you have two options:

  • Assign a target to each menu item
  • Assign a target to the menu itself

I made the mistake of trying the first option, assigning the same target to each of the menu items. This effectively disabled the selectionIndex binding, rendering the popup menu completely useless.

It appears as if the only solution is to assign a target to the menu, not its items!