The main mode for packaging program files for distributions and storage on OS X is Disk Images. These images imitate exactly the behaviours of optical disks such as DVDs, which is the reason they are commonly used by most developers worldwide to distribute downloadable installers for their programs/applications. If you don’t know what a Disk Image is, remember the file you need to download whenever you choose to install some freeware software from the internet, such as Google Chrome? You need to click on the file, and then it “mounts.” From the opening window, you choose to install the program. The original file you downloaded is called a “Disk Image.”
Disk Images are indeed most useful for file distribution, but they can also be used to store files on your system, any external media or on a local network server. The server option is most useful if you want to encrypt your files so that no one else can access them.
To create a Disk Image on your OS X system, simply follow the steps below:
1. Open Disk Utility on your Mac, either by accessing it by Spotlight or by navigating to “Applications -> Utilities -> Disk Utility”.
2. Select “New Image” from the top row of options in Disk Utility.
3. A drop-down menu similar to the one below will show up. Here, you can name your image and set its size. For this tutorial, we’ve set it as 500MB, but you can set a size according to your own preferences.
(Tidbit: You can also encrypt your disk image here by using the “Encrypt” tab.)
4. Once you’re done tweaking the settings, click on “Create.”
Once created, the image will create and mount where you can copy files to it. However, you’ll notice that even if you don’t fill the 500MB image size, i.e if you enter less than 500MB of data, the image size will still be the same when you created it. So if you created an image that was 500MB in size, then the image file would be 500MB, even if there is only 90MB of data in it.
Now, this may seem logical to some people, but it might not be desired. You may want your disk to be able to contain 500MB of data but not always be 500MB on disk and only grow with the size of items you place in it. A dynamic resizable disk in OS X by following the below instructions:
How to “Sparse” or “Sparsebundle” Your Image With No Partition Scheme
Apple has included the options in Disk Utility to create “sparse” and “sparsebundle” image types. These images are dynamically resizable, meaning, if you create one without a partition, they will start with the size of the files you place in them. They’ll then grow as you keep on adding more files, up to the maximum size you set when creating the image.
To do this, when you’re creating your Disk Image using the steps above, simply select either “sparse” or “sparsebundle” from the “Image Format” menu when creating the image, and then choose “No Partition Map” from the “Partitions” menu, similar to the screenshot below:
If you have any other suggestions/comments/queries, don’t hesitate to post them in the comments below!