How To: Shrink DMG Files On A Mac


This was giving me a problem some days ago so I thought I’d write up a quick tutorial on how to shrink dmg files on a mac. Why would you want to do this ? Well lets say you are creating an application and you want to package it in a DMG so you open up Disk Utility and create a blank image. Well you can only choose certain sizes. Most of us would choose a 40MB image so we have plenty of initial space to work with.

As far as I know there are 2 methods for shrinking the dmg down to the size of its contents, they are listed below.

Method – 1:

  • Right Click on the DMG
  • Click Compress

This will generate a zip file down to the actual size of the content of the DMG since free space has 100% compression ratio.

Method – 2:

This method involves the use of the Terminal App which can be found under Applications -> Utilities -> Terminal

  • Launch Terminal
  • Type the following hdiutil resize -size 10M /Path/To/DMG/DMG_Name.dmg

Code Breakdown:

  • hdiutil – A utility that comes preinstalled with Mac OS X, that manipulates disk images, etc…
  • -size – An argument passed to hdiutil, indicating that you want to change the size of an image.
  • 10M – means I am changing the dmg size to 10 Megabytes, insert your own value here.
  • The rest should be self explanitory

So there you have it, 2 methods to resize your dmg in Mac OS X. Thanks for reading.

If anyone would benefit from having a little GUI App that resizes DMG’s let me know, if I receive enough requests, I might make one and post it here.

Similar Posts:

VN:F [1.9.22_1171]
Rating: 6.2/10 (6 votes cast)
VN:F [1.9.22_1171]
Rating: -5 (from 5 votes)
How To: Shrink DMG Files On A Mac, 6.2 out of 10 based on 6 ratings
Be Sociable, Share!

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!