SUBMIT A FILE TYPE CONTACT US SUPPORT ABOUT US

What Is a DMG File? The Signature Is in the Last 512 Bytes, Not the First

DMG files are Apple disk images that macOS opens as drives. Jump to your question below, or work through it in order.

40 min read Updated October 2026 Checked against sources and tests

What Is a DMG File? Apple's disk image, used to hand out Mac software

Short answer

DMG files are disk images that macOS opens as drives. Apple made the format, and software makers use it to hand out Mac apps. DMG files store the files and also the disk layout around them.

The signature is not at the start. A DMG file ends with a 512-byte trailer that begins with the text koly. In our tests, no single reader opened all 12 good DMG files. 7-Zip opened 11, dmg2img 9, libmodi 9 and qemu-img 8.

To check your DMG file, read the trailer test. To open one, read how to open DMG files. If yours is damaged, start with the damage tests.

DMG files are Apple's disk images: single files that macOS mounts as drives. Software makers use DMG files to hand out Mac apps, and Disk Utility makes them from folders and disks.

Picture a Mac app you downloaded today. The browser saves a file that ends in .dmg. You double-click it, a window opens with the app inside and you install the app from there. That window is a drive that does not exist, and the DMG file is the disk behind it.

FileInfo calls DMG files mountable disk images used mostly to distribute software to macOS, and says they can also contain other files. Wikipedia adds that Apple made the format because the resource fork of Mac apps did not travel well across networks like the Internet.

The full name is Universal Disk Image Format, or UDIF. Wikipedia says Apple has not published its documentation. So what we know comes from other people's notes, from man pages and from the tests below.

DMG file facts at a glance

Quick facts about DMG files
Property Value
Meaning Apple disk images, which macOS mounts as volumes
Ending .dmg for UDIF images. Older Mac OS 9 images used .img and .smi.
Made by Disk Utility and the hdiutil command, both from Apple. Other tools can write DMG files too.
MIME type application/x-apple-diskimage, says Wikipedia
Apple type name com.apple.disk-image, says Wikipedia
Starts with It depends on the kind. The start is the first stored chunk, so it has no fixed signature.
Ends with A 512-byte trailer that begins with the text koly
Packing inside None, ADC, zlib, bzip2, LZFSE or LZMA, says Wikipedia
Opens in Finder and Disk Utility on a Mac. 7-Zip, dmg2img, qemu-img and libmodi in our tests.
Safe to open Looking inside is low risk. Starting an app inside executes its code, so install only apps you trust.

Wrong page? Other disk images, like VHD and ISO files, are in the disk image guide. A raw copy made with dd has its own page, the DD file guide. Windows installers end in .exe or .msi, and the EXE file guide and the MSI file guide cover them. Ordinary archives are in the ZIP file guide.

How Do You Know Your File Is a DMG File? The signature is in the last 512 bytes, not the first

Check the last 512 bytes. DMG files end with trailers that begin with the text koly, and the first bytes say almost nothing. In our 12 good DMG files, the first 8 bytes came out nine different ways.

Many pages say DMG files start with a fixed signature. They do not. The start of every DMG file is the start of the first stored chunk, and that chunk can be zeros, zlib, bzip2, LZFSE, XZ or ADC data. The figure shows the first 8 bytes of all 12 good files we built, next to the start of their trailers.

A table of the 12 good DMG files we built, showing the first 8 bytes of every file and the start of its last 512 bytes. The first 8 bytes differ: zeros for the uncompressed and stub files, then zlib, bzip2, LZFSE, XZ and ADC data. Nine different starts appear in 12 files. The last 512 bytes start with the text koly in all 12
The start changes with the kind of DMG file. The end does not.

Our own earlier page on this site listed 78 01 73 0D 62 62 60 as the file signature. That was wrong. It is the start of a zlib stream. We rebuilt it. The first sector of a disk with an Apple Partition Map starts with the letters ER. Zlib at its fastest level squeezes those 512 bytes into 78 01 73 0d 62 62 60 60. Our UDZO file with that map starts 78 9c 73 0d 62 62 60 60. The bytes after the first two match, because we used the default level. That pattern shows up in some DMG files and not others.

The trailer is the better test. The script below finds the text koly in the last 64 KiB and checks that it starts exactly 512 bytes before the end. It then reads the property list that the trailer names, tests stored checksums and decodes the zlib and bzip2 chunks it finds. Save it as check_dmg.py and give it the name of your DMG file.

Check DMG files with Python
#!/usr/bin/env python3
"""check_dmg.py - look inside a .dmg without a Mac.  Usage: python3 check_dmg.py file.dmg
Reads the 512-byte koly trailer, the XML plist and every block table. Decodes zlib and bzip2 chunks to test them."""
import sys, os, zlib, bz2, plistlib, base64
from struct import unpack_from as u

TYPES = {0: 'zero', 1: 'raw', 2: 'ignore', 0x7FFFFFFE: 'comment', 0x80000004: 'adc', 0x80000005: 'zlib',
         0x80000006: 'bzip2', 0x80000007: 'lzfse', 0x80000008: 'lzma', 0xFFFFFFFF: 'end'}

def kind(head):
    for sig, name in [(b'<!DOCTYPE', 'an HTML page'), (b'<html', 'an HTML page'), (b'PK\x03\x04', 'a ZIP archive'),
                      (b'xar!', 'a macOS installer package (pkg)'), (b'\x1f\x8b', 'a gzip file'), (b'CD001', 'an ISO image')]:
        if head.startswith(sig): return name
    if head[0x8001:0x8006] == b'CD001': return 'an ISO image'
    return None

def check(path):
    out, bad = [], []
    size = os.path.getsize(path)
    out.append(f'{path}: {size:,} bytes')
    if size == 0: return out, ['the file is empty']
    f = open(path, 'rb'); head = f.read(16)
    out.append('first 8 bytes: ' + ' '.join(f'{x:02x}' for x in head[:8]))
    k = kind(head)
    if k: bad.append(f'the file is {k}, not a disk image')
    f.seek(max(0, size - 65536)); tail = f.read()
    pos = tail.rfind(b'koly')
    if pos < 0: bad.append('no koly trailer in the last 64 KiB'); return out, bad
    t = size - len(tail) + pos
    if t + 512 != size: bad.append(f'koly found at {t:,} but {size - t - 512:,} extra bytes follow it')
    f.seek(t); kb = f.read(512)
    ver, hs, flags = u('>III', kb, 4); dfl = u('>Q', kb, 32)[0]
    xo, xl = u('>QQ', kb, 216); sectors = u('>Q', kb, 492)[0]
    out.append(f'trailer at {t:,}: version {ver}, header size {hs}, {sectors:,} sectors, data fork {dfl:,} bytes')
    if (ver, hs) != (4, 512): bad.append('trailer version or size is not 4 and 512')
    if u('>I', kb, 80)[0] == 2 and u('>I', kb, 88)[0]:
        f.seek(0); c = 0; left = dfl
        while left > 0:
            d = f.read(min(left, 1 << 20)); c = zlib.crc32(d, c) & 0xFFFFFFFF; left -= len(d)
            if not d: break
        if c != u('>I', kb, 88)[0]: bad.append('data fork checksum in the trailer does not match the data')
    if xl == 0: out.append('no plist: raw disk plus trailer (a stub image)'); return out, bad
    if xo + xl > t: bad.append('plist range goes past the trailer'); return out, bad
    f.seek(xo); xml = f.read(xl)
    try: pl = plistlib.loads(xml)
    except Exception: bad.append(f'plist at {xo:,} will not parse'); return out, bad
    count = {}
    for b in pl['resource-fork']['blkx']:
        m = b['Data']
        if m[:4] != b'mish': bad.append(f"{b['Name']}: block table has no mish signature"); continue
        first, n = u('>QQ', m, 8); nent = u('>I', m, 200)[0]; crc = u('>I', m, 72)[0]; got = 0; seen = 0
        for i in range(nent):
            ty, _, st, ct, off, ln = u('>IIQQQQ', m, 204 + 40 * i)
            if ty == 0xFFFFFFFF: continue
            seen += 1; name = TYPES.get(ty, hex(ty)); count[name] = count.get(name, 0) + 1
            if got is None or ty == 2: continue
            if ty == 0: got = zlib.crc32(b'\0' * (ct * 512), got) & 0xFFFFFFFF
            elif ty in (1, 0x80000005, 0x80000006):
                f.seek(off); d = f.read(ln)
                try:
                    d = d if ty == 1 else (zlib.decompress(d) if ty == 0x80000005 else bz2.decompress(d))
                except Exception:
                    bad.append(f"{b['Name']}: chunk at {off:,} will not decode"); got = None; continue
                if len(d) != ct * 512: bad.append(f"{b['Name']}: chunk at {off:,} is the wrong size")
                got = zlib.crc32(d, got) & 0xFFFFFFFF
            else: got = None   # lzfse, lzma and adc are not decoded here
        if got and crc and got != crc: bad.append(f"{b['Name']}: block table checksum does not match the data")
        out.append(f"  {b['Name']}: sectors {first}-{first + n - 1}, chunks {seen}")
    out.append('chunk types: ' + ', '.join(f'{v} {k}' for k, v in sorted(count.items())))
    return out, bad

if __name__ == '__main__':
    for p in sys.argv[1:]:
        o, b = check(p); print('\n'.join(o))
        print('PROBLEMS:' if b else 'No problems found.'); [print(' -', x) for x in b]
The answer for our good UDZO DMG file
g03-udzo-zlib.dmg: 3,216,834 bytes
first 8 bytes: 78 9c 63 60 18 05 43 19
trailer at 3,216,322: version 4, header size 512, 45,056 sectors, data fork 3,207,943 bytes
  Protective Master Boot Record (MBR : 0): sectors 0-0, chunks 1
  GPT Header (Primary GPT Header : 1): sectors 1-1, chunks 1
  GPT Partition Data (Primary GPT Table : 2): sectors 2-33, chunks 1
   (Apple_Free : 3): sectors 34-2047, chunks 1
  disk image (Apple_HFS : 4): sectors 2048-43007, chunks 9
   (Apple_Free : 5): sectors 43008-45022, chunks 1
  GPT Partition Data (Backup GPT Table : 6): sectors 45023-45054, chunks 1
  GPT Header (Backup GPT Header : 7): sectors 45055-45055, chunks 1
chunk types: 2 ignore, 1 raw, 2 zero, 11 zlib
No problems found.

We tried the script on all 12 good DMG files and all 24 damaged copies. It flagged none of the good files and 21 of the 24 damaged ones. It cannot see a flipped bit in stub files, which have no checksum, or a wiped file system inside valid containers. The section on damaged files lists all 24.

The answer for our DMG file with 100 extra bytes after the trailer
d04-trailer-junk-after.dmg: 3,216,934 bytes
first 8 bytes: 78 9c 63 60 18 05 43 19
trailer at 3,216,322: version 4, header size 512, 45,056 sectors, data fork 3,207,943 bytes
  Protective Master Boot Record (MBR : 0): sectors 0-0, chunks 1
  GPT Header (Primary GPT Header : 1): sectors 1-1, chunks 1
  GPT Partition Data (Primary GPT Table : 2): sectors 2-33, chunks 1
   (Apple_Free : 3): sectors 34-2047, chunks 1
  disk image (Apple_HFS : 4): sectors 2048-43007, chunks 9
   (Apple_Free : 5): sectors 43008-45022, chunks 1
  GPT Partition Data (Backup GPT Table : 6): sectors 45023-45054, chunks 1
  GPT Header (Backup GPT Header : 7): sectors 45055-45055, chunks 1
chunk types: 2 ignore, 1 raw, 2 zero, 11 zlib
PROBLEMS:
 - koly found at 3,216,322 but 100 extra bytes follow it
What files that are not DMG files show
Kind Where to look What you see
DMG file The last 512 bytes The text koly, in every file we built
ZIP archive Bytes 0 to 3 50 4b 03 04
Gzip file Bytes 0 and 1 1f 8b
ISO image Bytes 32,769 to 32,773 The text CD001
Web page saved as .dmg The first bytes The text <!DOCTYPE or <html
Empty file The size 0 bytes

Four more clues about your DMG file

The file command Version 5.45 named the first chunk of 10 DMG files as zlib, bzip2, LZFSE or XZ data, or as a DOS/MBR boot sector. It said only data for the ADC file. It never said DMG.
The 7z l command It printed Type = Dmg for 11 of the 12 DMG files. For the stub it printed Type = GPT, because it skipped the trailer and read the disk.
The qemu-img info command It printed file format: dmg and the disk size for 11 of the 12 DMG files, even for the LZMA file it could not read. It refused the stub.
The ending Our ZIP file and our ISO file, both saved as .dmg, kept their names. Read the bytes before you trust the ending.

What Is Inside a DMG File? Data chunks, a property list and a 512-byte trailer

DMG files have three parts: data chunks, an XML property list and a 512-byte trailer. The trailer says where the list is. The list stores one block table per partition, and every table says where its chunks are and how they were packed.

Think of a moving truck. The boxes go in first. Then comes the packing list. Last in the truck is a sticky note that says where the list is. To unload, you start from the note. Readers of DMG files do the same: they look at the end of the DMG file first.

A diagram of one UDZO DMG file of 3,216,834 bytes. The data fork of 3,207,943 bytes comes first and stores zlib chunks. Then comes the XML property list of 8,379 bytes with one block table per partition. The 512-byte trailer is last and begins with koly. Step 1: read the last 512 bytes. Step 2: use the property list offset and length to read the list. Step 3: every block table lists chunks that point back into the data fork
Read DMG files from the end: trailer, property list, then chunks.

The numbers in the figure come from our UDZO file. Its data fork is 3,207,943 bytes and the property list adds 8,379 more. The trailer fills the last 512. All fields are big endian, says the newosxbook.com write-up, so the number 512 is stored as 00 00 02 00.

The 512-byte trailer

Fields of the DMG trailer we used
Field Where What it stores
Signature byte 0 The text koly
Version byte 4 4
Header size byte 8 512
Data fork length byte 32 How many bytes of chunk data come first
Data checksum bytes 80 to 215 Type, size and value
Property list bytes 216 and 224 Where the XML starts and how long it is
Master checksum bytes 352 to 487 Checksum of the block table checksums
Image variant byte 488 Usually 1
Sector count byte 492 How many 512-byte sectors the disk has when expanded

The positions come from the libmodi documentation and the newosxbook write-up. Four readers opened files that we wrote with these same positions, so we trust them. We read no fields from files made by a Mac.

The property list and block tables

The property list is XML. Its resource-fork entry has the blkx array, with one item per partition, and every item stores a base64 block table. Every table starts with the text mish. It names the first sector, the sector count and the list of entries. Every entry is 40 bytes: type, comment, first sector, sector count, offset and length.

Packing happens per chunk, not per file. Our writer cut every partition into chunks of 1 MiB. Our UDZO file had 16 entries in its 8 tables: 11 zlib, 2 zero, 2 free and 1 raw. That is why one bad chunk can hurt only part of the disk. The damage tests show that most readers still stop at the first bad one.

Entry types we found or read about
Type What it means
00000000 Zeros. No bytes stored. The reader writes zeros.
00000001 Raw. The bytes are stored as they are.
00000002 Free space. A gap in the disk. No bytes stored.
80000004 ADC. The oldest Apple packing.
80000005 zlib. The UDZO kind.
80000006 bzip2. The UDBZ kind.
80000007 LZFSE. The ULFO kind.
80000008 LZMA. The ULMO kind.
7ffffffe Comment. Marks the start or end of a section.
ff ff ff ff End. Closes the list of chunks.

The disk behind the chunks

Put the chunks back in order and you get the disk. It can have a GUID partition table, which is what our main files used, an Apple Partition Map or no table at all. We made all three. The partitions store file systems. Apple's Disk Utility guide lists APFS, MS-DOS (FAT) and ExFAT for new images. Ours used HFS+, FAT32 and an ISO 9660 and HFS+ hybrid. We made no APFS image.

Which Kind of DMG File Do You Have? UDRO, UDZO, ULFO and the other Disk Utility codes

DMG files come in about a dozen kinds, named by four-letter codes. The code sets the packing, whether you can write to the DMG file and which macOS version made it. Disk Utility offers only some of the kinds today.

The codes come from the hdiutil man page and from the Apple Disk Image entry. The file itself does not store the code as text. It stores chunk types like zlib and bzip2, and an image variant number in the trailer. Tools read those and name the kind for you.

Kinds of DMG file and what we made
Code What it is Our files
UDRO Read-only, no packing. The data is stored as it is. Made 1 file
UDRW Read/write, no packing. Some of these have a trailer and no property list. Made 1 stub
UDZO Read-only, zlib packing. The default packed kind since OS X 10.2, says the hdiutil man page. Made 6 files
UDBZ Read-only, bzip2 packing. Added in OS X 10.4 and deprecated in macOS 12. Made 1 file
ULFO Read-only, LZFSE packing. Needs OS X 10.11 or later. Made 1 file
ULMO Read-only, LZMA packing. Needs macOS 10.15 or later. Made 1 file
UDCO Read-only, ADC packing, the older Apple method. Made 1 file
UDTO DVD or CD master for export. Not made
UDSP and UDSB Sparse images and sparse bundles that grow as you add files. Not made
UNIV Hybrid image with HFS+, ISO and UDF. Not made
ASIF Apple Sparse Image Format, listed in the current Disk Utility guide. Not made

Apple's current guide to Disk Utility lists Read-only (UDRO) and Read-only Compressed (ULFO) when you copy a disk or folder. It lists Read/write for secure images, and Sparse Bundle and Apple Sparse Image for blank ones. It does not list UDZO. The hdiutil command still writes that kind, and our tests say why it matters: zlib files opened in more readers than any other packed kind.

Stub DMG files

The libmodi documentation says the property list can be empty, as in UDIF stubs. A stub is the raw disk followed by the 512-byte trailer. Our stub was the most confusing file in the set. 7-Zip opened it as a GPT disk and returned all four files. For dmg2img the file was corrupted, and qemu-img could not open it. libmodi opened it and returned no bytes.

Apple may write read/write images in other ways. We made our stub ourselves and had no Mac-made UDRW file to compare.

Sparse images and bundles

The .sparseimage ending stores the disk in bands that grow as you add files, and .sparsebundle is a folder of band files, says the libmodi documentation. Neither has the koly trailer of UDIF files. We tested neither one. The section on other endings lists them next to the older Mac OS 9 formats.

What Do 36 Test DMG Files Show? 12 good DMG files, 24 damaged copies and four readers

No single reader opened all 12 good DMG files we built. 7-Zip returned all four test files from 11, dmg2img from 9, libmodi from 9 and qemu-img from 8. Only 7 DMG files opened in all four. Then we tried the same readers on 24 damaged copies.

We found no public set of DMG files with known content. Files from Mac apps have content we cannot compare. So we built our own on Ubuntu 24.04 in October 2026. Every DMG file got the same four test files: hello.txt with 28 bytes, notes.txt with 44, docs/report.txt with 1,150 and photo.bin with 200,000 random bytes. Two filler files of 1.5 MB spread them over different chunks.

We damaged copies in 24 ways and tried four readers on all 36 DMG files. The readers were 7-Zip 23.01, dmg2img 1.6.7, qemu-img 8.2.2 and libmodi 20260902. The Sleuth Kit 4.12.1 listed the file systems inside what they returned. Files counted as returned only when their SHA-256 hashes matched the originals.

We did not test any DMG file made by a Mac. Our files came from our own Python writer and from libdmg-hfsplus. We did not use hdiutil, Disk Utility, Finder or Gatekeeper. We left out encrypted DMG files, APFS volumes, sparse images, disks over 42 MiB and the SysTools and Freeviewer viewers. No reader could open our LZMA file, so we cannot say it matches what Apple writes.

36 DMG files tested
12 good DMG files we built
24 damaged DMG files
4 readers used

The 12 good DMG files we built

The 12 good DMG files and what they test
DMG file What it is
UDRO Every chunk stored as it is, GPT disk, HFS+. 23,078,212 bytes.
UDRW stub The raw GPT disk plus the trailer, with no property list. 23,069,184 bytes.
UDZO zlib chunks, GPT disk, HFS+. 3,216,834 bytes.
UDBZ bzip2 chunks. 3,221,375 bytes.
ULFO LZFSE chunks. 3,232,231 bytes.
ULMO LZMA chunks in an XZ container. 3,214,799 bytes.
UDCO ADC chunks. 3,413,331 bytes.
UDZO, Apple Partition Map The older partition map. 3,213,624 bytes.
UDZO, no partition map Bare HFS+ volume. 3,211,303 bytes.
UDZO, second writer Made with libdmg-hfsplus, not our code. 3,236,171 bytes.
UDZO, FAT32 FAT32 volume on a GPT disk. 213,385 bytes.
UDZO, ISO hybrid An ISO 9660 and HFS+ image. 207,176 bytes.

The four test files were the same in every DMG file. Every reader that found them gave back the same bytes. So the counts below show what these readers can open, and not what they can restore.

Which readers opened the 12 good DMG files
Reader DMG files read Note
7-Zip 23.01 11 of 12 All but the LZMA file, which it calls an unsupported method. It opened the stub as a GPT disk.
dmg2img 1.6.7 9 of 12 No stub and no LZMA file. For the LZFSE file it said success and wrote a short file.
libmodi 9 of 12 Read raw, zlib, ADC and LZFSE chunks. Failed on bzip2 and LZMA, and returned nothing from the stub.
qemu-img 8.2.2 8 of 12 Read bzip2 only after we added the qemu-block-extra package. No LZFSE, LZMA, ADC or stub.
A grid of four readers against the 12 good DMG files. 7-Zip returned all 4 test files from every file except the LZMA one. dmg2img returned them from the raw, bzip2, ADC and all zlib files, and returned nothing from the stub, the LZFSE file and the LZMA file. libmodi returned them from raw, zlib, ADC and LZFSE files and nothing from the stub, bzip2 and LZMA files. qemu-img returned them from the raw, bzip2 and zlib files and nothing from the stub, LZFSE, LZMA and ADC files
7-Zip read 11 of 12, dmg2img 9, libmodi 9 and qemu-img 8.

The LZFSE file shows the risk of a quiet reader. dmg2img finished it with the words Archive successfully decompressed and exit code 0. The raw file it wrote was 17,791,488 bytes, which is 5,277,184 short of the 23,068,672 bytes it should have had. Sleuth Kit then found no file system in it.

Where readers wrote raw disks, we hashed them. For the UDRO, UDZO, UDBZ, partition map, bare, FAT32 and hybrid files, qemu-img and dmg2img both matched the SHA-256 hash of the disk we started from. For the ADC file, dmg2img did the same. The libdmg file differs on purpose: its writer adds a partition map around the volume, so its raw disk is 41,984 bytes larger.

The 24 damaged DMG files

We damaged copies of the good files in 24 ways, with one kind of damage in every case. The full list of 24 cases gives the fix for every one. The table counts the cases where at least one reader returned all four files.

Damaged DMG files that gave back all 4 files
Damage (cases) Before repair After repair
Trailer cut, zeroed, changed or padded (5) 1 5
Property list damaged (1) 1 1
Wrong checksum stored in the DMG file (2) 2 2
Flipped bit in the data (6) 0 0
Cut file or lost chunk (4) 0 0
File system damaged inside a valid DMG file (2) 0 2
Not a DMG file at all (4) 2 2
All 24 cases 6 12

Before repair means at least one reader returned all four files from the damaged copy. After repair means the same check after one small fix on that copy. Six cases gained. Four needed new trailers and two needed file system checks. Seven cases stayed at three files, and five gave nothing.

The trailer is the weak spot Cut it, zero it or change koly to kolx, and all four readers refuse the DMG file, though every data byte is still there. Putting back the four letters fixed the kolx case.
Readers skip stored checksums We changed the data checksum in one copy and a table checksum in another. All four readers opened both with no complaint.
One bad chunk can stop a reader Flipped bits in zlib or bzip2 chunks made all four readers refuse the entire disk. The data after the bad chunk was fine.
Quiet damage in raw files A flipped bit in the UDRO file passed all four readers with no error. photo.bin came back at full size with one wrong bit.

Read the counts with care. We damaged small DMG files with simple breaks. Failing drives, bad downloads and half-finished copies do messier harm. The numbers show how these readers behave with these files, and they are not rates for all DMG files.

What Does Our Expert Say About DMG Files? A note from Neeraj Singh on stored checksums

Hash DMG files when you get them, and compare the hash again before you trust a copy. In our tests, one flipped bit inside an uncompressed DMG file passed all four readers, and only a checksum or hash found it.

Neeraj Singh

Expert insight

“A DMG file keeps its signature in the last 512 bytes, so a viewer that shows only the start will mislead you. In our tests, one flipped bit inside an uncompressed DMG file passed all four readers with no error. The checksum in the trailer caught it, but none of the readers checks it. Hash every DMG file you download, and compare the hash with the one on the vendor page.”

Neeraj Singh Manager, Tech Support & Operations 19+ years fixing Windows and system errors

Why a quiet result can still be wrong

The UDRO copy with one flipped bit gave back photo.bin at its full size of 200,000 bytes. 7-Zip, dmg2img, qemu-img and libmodi all did the same, and none raised an error. The trailer stores a checksum of the data. Our script compared it and said it did not match. The four readers never looked at it.

Packed chunks behave in the opposite way. Zlib and bzip2 have their own checks, so a flipped bit in one chunk stopped all four readers. LZFSE and ADC have no such check in our files. libmodi decoded them and returned a wrong photo.bin with no message, and the other readers failed.

So files can fail checks and still open, and files can pass every reader and still be wrong. Both cases have one defense. Compare the hash you saved or got from the source. The verify section shows the steps.

Our script missed 3 of the 24 damaged files. One was a flipped bit in the stub, which stores no checksum. The other two had wiped HFS+ volume headers or catalogs inside valid containers. The containers were fine, and the file systems were not. Only a file system check finds that.

Keep the original. Work on copies of DMG files, and keep the first hash. If a repair goes wrong, you can start again. Our own repair of the damaged property list made things worse, because it lost two block tables.

How Do You Open DMG Files? Double-click on a Mac, 7-Zip on Windows and Linux

On a Mac, double-click the DMG file. On Windows or Linux, open it with 7-Zip. In our tests, 7-Zip returned all four test files from 11 of 12 good DMG files, more than dmg2img, libmodi or qemu-img.

Opening a DMG file is different from installing what is inside it. Opening mounts the disk or unpacks it. Installing starts code. Open as many DMG files as you like, and install only apps you trust.

Ways to open DMG files
Program What it does What we saw
Finder Mounts a DMG file as a volume, says Wikipedia Not tested
Disk Utility and DiskImageMounter Apple's own tools, bundled with macOS, says FileInfo Not tested
7-Zip Free archiver that lists and extracts the files, on Windows and Linux 11 of 12 DMG files
dmg2img Command line tool that writes a raw disk from a DMG file 9 of 12 DMG files
libmodi Library and Python module, pymodi, that reads disk images 9 of 12 DMG files
qemu-img Converts a DMG file to a raw disk, then you mount or list it 8 of 12 DMG files
PeaZip Free archiver, listed by Wikipedia for HFS and HFS+ DMG files Not tested

Open a DMG file on a Mac

  1. Double-click the DMG file in your Downloads folder. macOS mounts it as a volume in Finder.
  2. Open the volume and install the app inside it. FileInfo says this is what most Mac users do.
  3. Eject the volume when you are done.
Open and close a DMG file in Terminal
# Mac commands, not tested here
hdiutil attach app.dmg
ls /Volumes
hdiutil detach /Volumes/App

If macOS warns about an app from a developer it does not know, Apple's page on apps from unidentified developers has the steps. Open System Settings, go to Privacy & Security, scroll to Security and click Open Anyway. The button shows for about an hour after you try to open the app. Then enter your login password.

Apple's own advice. Apple says the safest approach is to find the app in the Mac App Store or to find an alternative. It also says that overriding security settings is a common way Macs get infected.

Open a DMG file on Windows with 7-Zip

7-Zip reads the trailer and block tables by itself. On our UDZO file, the list command printed the type Dmg, then the HFS+ volume, then the files. One pass was enough for 11 DMG files. The extract command writes the files to a folder.

List and save the files in a DMG file with 7-Zip
7z l g03-udzo-zlib.dmg
7z x g03-udzo-zlib.dmg -oout
What 7-Zip printed for our UDZO file (shortened)
7z l g03-udzo-zlib.dmg
Type = Dmg
Method = Zero0 Copy Zero2 ZLIB CRC
Blocks = 16
Comment = disk image (Apple_HFS : 4)
Type = HFS
Method = HFS+
   Date      Time    Attr         Size   Compressed  Name
2026-10-19 05:43:51 .....           28         4096  DMGTEST/hello.txt
2026-10-19 05:43:51 .....           44         4096  DMGTEST/notes.txt
2026-10-19 05:43:51 .....       200000       200704  DMGTEST/photo.bin
2026-10-19 05:43:51 .....         1150         4096  DMGTEST/docs/report.txt
6 files, 2 folders

7-Zip stopped on the LZMA file with the words Unsupported Method. It also goes by content, not by the ending. It opened the ZIP file and the ISO file that we had saved as .dmg, and it read the stub as a GPT disk.

Open a DMG file on Linux

Convert the DMG file to a raw disk with dmg2img or qemu-img, then list the files with Sleuth Kit or mount the disk. Wikipedia names the mount type hfsplus. Our kernel had no hfsplus driver, so we listed files with Sleuth Kit and 7-Zip instead and left the mount line untested.

Open a DMG file on Linux
dmg2img -i app.dmg -o app.img
# or, with qemu-img
qemu-img convert -f dmg -O raw app.dmg app.img
# the first partition starts at sector 2,048 on our GPT disks
fls -r -o 2048 app.img
# a Linux kernel with HFS+ support can mount it (not tested)
sudo mount -o loop,ro,offset=1048576 -t hfsplus app.img /mnt/dmg

Two warnings from our tests. On Ubuntu 24.04, qemu-img read bzip2 DMG files only after we installed the qemu-block-extra package. And dmg2img finished the LZFSE file with no error and a short result, so compare the size of its output with the sector count in the trailer.

Free viewers and reference pages

These cards link to outside pages: two Windows viewers for DMG files, Apple's guide to apps from unidentified developers and the Wikipedia article on Apple Disk Image.

SysTools DMG Viewer

Opens DMG files on Windows

Trial previews only

Freeviewer DMG Viewer

Opens DMG files on Windows

Demo previews only

Apple: unidentified developers

Steps for Open Anyway

Apple page

Apple Disk Image on Wikipedia

History, kinds and tools

Wikipedia page

SysTools describes a Windows viewer, version 3.0, that opens read-only and compressed DMG files. It previews EML, EMLX, text, GIF and HTML items, shows a hex view and searches by name, type, text or date. Its page says the trial previews only and saving needs the paid version. It needs .NET Framework 4.5 or later. We did not start it.

Freeviewer describes a Windows viewer, also version 3.0, for browsing DMG files, mainly to read emails and attachments. It lists folder browsing, several preview views, search and date filters. It says the free demo only previews data and that saving needs the Pro version. It says encrypted, corrupted and password-protected DMG files work. We did not start this one either.

Both pages focus on email files found inside DMG files. For those, see the EML file guide and the MBOX file guide.

Tip for Mac users. You do not need a viewer on your Mac. Finder opens DMG files, and the section on damaged files covers the cases where it will not.

How Do You Make a DMG File? Disk Utility, hdiutil and the macOS 27 change

Make a DMG file with Disk Utility, or with the hdiutil command in Terminal, then hash your DMG file right away. For readers on Windows and Linux, UDZO is the safest kind in our tests. Apple has marked hdiutil as deprecated in the macOS 27 beta.

Making a DMG file means reading folders or disks and saving them as UDIF images. We made our 12 test files with our own Python writer and with libdmg-hfsplus, because we had no Mac. The Mac steps below come from Apple's guide and the hdiutil man page, and we did not test them.

  1. Open Disk Utility and choose File, then New Image.
  2. Choose Image from Folder for the files only, or the device option for a copy of the entire disk with its free space. Apple says a disk image includes the free space and a folder image does not.
  3. Name your DMG file, choose where to save it, choose the encryption and the image format, then click Save and Done.
  4. Hash the new DMG file right away and save the hash away from it.
Make DMG files in Terminal or on Linux
# Mac commands, not tested here
hdiutil create -srcfolder MyApp -volname MyApp -format UDZO MyApp.dmg
hdiutil convert MyApp.dmg -format UDRW -o MyApp-rw.dmg
hdiutil imageinfo MyApp.dmg
# Linux: build a UDZO file from an HFS+ volume (libdmg-hfsplus, tested)
dmg build volume.hfs MyApp.dmg

Which kind should you choose? For Macs only, Disk Utility's Read-only Compressed (ULFO) is fine. If your DMG file will go to Windows or Linux users, think about zlib. In our tests, the UDZO files opened in all four readers. The ULFO file opened in two, and the ULMO file in none.

How our test kinds fared
Kind Readers that returned all 4 files Note
UDZO 4 of 4 All six of our UDZO files, with five different disk layouts.
UDRO 4 of 4 Large, because nothing is packed. About 23 MB against 3.2 MB for UDZO.
UDBZ 3 of 4 libmodi could not read bzip2.
UDCO 3 of 4 qemu-img could not read ADC.
ULFO 2 of 4 7-Zip and libmodi read it. dmg2img wrote a short file.
ULMO 0 of 4 No reader could open our LZMA file.

hdiutil in macOS 27

Iru reported on August 28, 2026 that the macOS 27 beta man page says hdiutil is deprecated and points to diskutil image for all disk image work. Deprecated is not removed. Iru says hdiutil still works. Its early tests found diskutil image faster but missing some options. We did not test macOS 27.

Do not image a failing disk. Apple says not to make an image of a failing or corrupted disk, because the image may not be a reliable backup. Copy the files first, or use a recovery tool.

How Do You Check a DMG File Is Sound? A hash, hdiutil verify and a short script

Check DMG files with the hash from the source, then with hdiutil verify on a Mac or our script elsewhere. In our tests, only a stored checksum or hash found flipped bits in uncompressed DMG files. None of the four readers did.

A hash is the short fingerprint of your DMG file. Change one bit and the fingerprint changes. Get the hash from the page you downloaded from, or make one the day you create the DMG file. The check shows whether your copy matches. It cannot show that the first copy was good.

  1. Find the hash on the download page, or make one when you create the DMG file.
  2. Make the hash of your DMG file with shasum, sha256sum or Get-FileHash.
  3. Compare the two by eye or with a tool. One different character means a different file.
  4. On a Mac, use hdiutil verify. It checks the image against its stored checksum.
Check DMG files with a hash and with the format tools
# Mac commands, not tested here
shasum -a 256 app.dmg
hdiutil verify app.dmg
diskutil verifyVolume /Volumes/App
# Linux
sha256sum app.dmg
python3 check_dmg.py app.dmg
# Windows PowerShell, not tested here
Get-FileHash app.dmg -Algorithm SHA256
The answer for the UDRO file with one flipped bit
d10-flip-raw.dmg: 23,078,212 bytes
first 8 bytes: 00 00 00 00 00 00 00 00
trailer at 23,077,700: version 4, header size 512, 45,056 sectors, data fork 23,068,672 bytes
chunk types: 27 raw
PROBLEMS:
 - data fork checksum in the trailer does not match the data
 - disk image (Apple_HFS : 4): block table checksum does not match the data
What the checks found
Check What we found
sha256sum on the UDRO copy with a flipped bit A different hash from the original. Four readers had opened it with no error.
check_dmg.py on the 12 good files No problems found.
check_dmg.py on the 24 damaged files It flagged 21. It missed the stub with the flipped bit and the two with damaged HFS+ volumes.
Readers on a wrong stored checksum All four opened both copies: the one with the wrong data checksum and the one with the wrong table checksum.
fsck.hfsplus on two damaged HFS+ volumes It repaired both. All four test files then matched their hashes.
hdiutil verify and diskutil verifyVolume Not tested. We had no Mac.

Eclectic Light explains what the Mac side does. Read-only and compressed images store a checksum of their contents, and mismatches probably mean damage, so fresh copies are the best fix. Read/write images store none. The Eclectic Light article also says macOS checks the file system on some downloaded images, and that damaged volumes are different problems from damaged images.

The hdiutil man page agrees on the split. It says verify checks an image against its stored checksum, and that read/write images store none. It adds that diskutil verifyVolume is what checks whether the file system inside is consistent.

A mount option to avoid

Eclectic Light notes that the hdiutil options -noverify and -ignorebadchecksums mount an image even when the checksum fails. It says either option can cause a kernel panic, so save your work first. Use them only on a DMG file you trust and have a good copy of.

Compare the same thing. The hash of your DMG file is not the hash of the disk inside it. Packing and the trailer change the bytes. To compare with raw disks, convert the DMG file first and hash the raw output.

Why Will Your DMG File Not Open? Twenty-four damage tests, and the repairs that worked

DMG files that will not open usually have damaged trailers. In our 24 damaged cases, readers returned all four files from 6 as they were and from 6 more after one repair. Seven gave only three files, and five gave nothing.

We broke copies of the good DMG files in 24 ways and tried the readers before and after repairs. The chart shows what the readers could do. Green means all 4 test files came back byte for byte, amber means some did and red means none did.

A grid of 24 damage tests with columns for files back before and after repair, how many of the four readers gave back all 4 files, and the fix. Damage to the trailer, a cut-off trailer, a changed signature and a wrong offset were fixed by rebuilding or restoring the trailer. Extra bytes after the trailer were cut off. Wrong checksums were ignored by every reader. A wiped HFS+ volume header or catalog was fixed with fsck.hfsplus. Flipped bits in packed chunks left three of four files after the bad chunk was filled with zeros, and flipped bits in raw, stub, LZFSE and ADC files passed silently. Files cut in half or at 95 percent, a broken first volume chunk, an HTML page and an empty file could not be restored
24 tests. Files back: green is all 4, amber is some and red is none.
Damage we met and what fixed it
Damage What you see Fix
Trailer cut off or zeroed All four readers refused it. 7-Zip said it could not open the file as a Dmg archive, and qemu-img could not find the trailer. Rebuild the trailer from the property list
koly changed to kolx The same messages as above, though only four letters were wrong. Write koly back
100 extra bytes after the trailer Only 7-Zip opened it. dmg2img said the image was corrupted. Cut the DMG file 512 bytes after koly
Property list offset wrong dmg2img said the property list was corrupted. The others could not find a trailer. Rebuild the trailer
Property list with 8 bad bytes 7-Zip and libmodi stopped. dmg2img and qemu-img still read the DMG file. Use dmg2img or qemu-img
Wrong CRC in the trailer or a table Nothing. All four readers opened both copies. None needed to open it
HFS+ volume header or catalog wiped All four readers found a container and then no file system. Check the volume with fsck.hfsplus
Flipped bit in zlib or bzip2 chunks All four readers refused the entire disk. Fill the chunk with zeros
Flipped bit in an LZFSE or ADC chunk libmodi returned a wrong photo.bin and said nothing. The others failed. Only a hash finds it
Flipped bit in a raw or stub file Every reader that could open it returned a wrong photo.bin and said nothing. Only a hash finds it
ZIP or ISO file saved as .dmg 7-Zip opened both by their content. libmodi opened the ISO file. dmg2img and qemu-img refused both. Rename the DMG file

The repairs, in small patches

Always work on a copy. The dd option conv=notrunc matters: without it, dd cuts the DMG file after the bytes it writes and destroys the rest. The first command below put the four letters back and fixed our kolx file. All four readers then opened it, and our script found no problem. The last two lines cut 100 extra bytes from the padded file.

Two trailer repairs we tested, on copies of the DMG files
# write koly back at 512 bytes before the end (work on a copy)
size=$(stat -c %s broken.dmg)
printf 'koly' | dd of=broken.dmg bs=1 seek=$((size - 512)) conv=notrunc
# cut extra bytes: check_dmg.py said koly is at 3,216,322
# 3,216,322 + 512 = 3,216,834 bytes should remain
truncate -s 3216834 broken.dmg

A trailer that is cut off or zeroed needs more. It has to be written again from the property list: the data length, the offset and length of the list, the sector count and the checksums. Our repair script did that in the cut, zeroed and wrong-offset cases, and all four readers then returned all four files. The script is in our research folder.

A damaged file system inside a good DMG file

Two copies had wiped HFS+ volume headers or wiped starts of the catalog. The container was fine, so readers found the partitions and then no file system. We wrote the raw disk with dmg2img, cut out the HFS+ volume and checked it with fsck.hfsplus. It said the volume header needed minor repair and fixed it. 7-Zip then listed the files, and all four matched their hashes.

Check and repair an HFS+ volume from a DMG file
dmg2img -i damaged.dmg -o disk.img
# our HFS+ volume starts at sector 2,048 and has 40,960 sectors
dd if=disk.img of=hfs.img bs=512 skip=2048 count=40960
fsck.hfsplus -f -y hfs.img
7z l hfs.img

This works only when the volume is HFS+ and the damage is small. We did not test APFS volumes. On a Mac, Disk Utility has First Aid for the same job, but we did not use it.

What the tools could not fix

Wrong checksums stored in the file All four readers opened both copies. The data may be fine, but the DMG file no longer matches its own checksum. If the hash from the source also differs, download again.
Flipped bits in zlib or bzip2 chunks All four readers refused the disk. We wrote a new file with the bad chunk filled with zeros, and three of four files came back. The data in that chunk is gone.
Flipped bits in raw, stub, LZFSE or ADC data The readers that opened these returned photo.bin at full size with a wrong bit and no message. Only the checksum, or a hash, finds it. The fix is a good copy.
Broken first chunk of the volume The volume header sat in that chunk. Filling it with zeros left a disk with no file system, and no reader opened it.
Files cut in half or at 95 percent The property list and the trailer were gone, and none of our steps could rebuild them. A download that stops part way looks like this.
Web pages or empty files saved as .dmg Nothing to restore. The web page was an error message, so download the DMG file again.
Extra bytes after the trailer We added 100 zero bytes. After we cut them off, all four readers returned all four files.

Our repair of the damaged property list made things worse. It rebuilt the list from the 7 block tables that still parsed and lost two. The original file opened in dmg2img and qemu-img, so use that copy.

Compare before you celebrate. After a repair, list the files and compare their hashes with the originals if you have them. DMG files that open do not always match the originals.

How Do You Convert a DMG File to Another Format? Raw disks, folders and ISO files, checked with a hash

Convert DMG files to raw disks with dmg2img or qemu-img, or to folders of files with 7-Zip. In our round trips, the raw disk had the same SHA-256 hash as the disk we started from for seven good files. Check the size of the output, because one reader finished with a short file.

Converting a DMG file reads the disk inside and writes it again in another form. A good conversion keeps the disk bytes the same, so the hash of the raw output should match the hash of the original disk. We checked that for every route.

What the conversion routes gave
Route What we saw
dmg2img to a raw disk The same SHA-256 hash as the source for 8 of the 9 DMG files it could read, including the ADC file. The ninth came from the libdmg writer, which adds a partition map.
qemu-img convert to raw The same hash for 7 of the 8 DMG files it could read. The eighth was the libdmg file again.
dmg2img on the LZFSE file Exit code 0 and the words Archive successfully decompressed, with a file 5,277,184 bytes short.
7-Zip to a folder All four test files matched their hashes for 11 of the 12 good DMG files.
qemu-img on the ISO and HFS+ hybrid file A raw file of 1,210,368 bytes that 7-Zip listed as an ISO image with 4 files, and xorriso loaded.
Convert DMG files to raw disks and hash the result
dmg2img -i app.dmg -o app.img
qemu-img convert -f dmg -O raw app.dmg app.img
sha256sum app.img
# or save the files into a folder
7z x app.dmg -oout
# Mac command, not tested here
hdiutil convert app.dmg -format UDRW -o app-rw.dmg

Mind the file system

DMG files store disks, and the disks store file systems. Ours used HFS+, FAT32 or an ISO hybrid. Converting does not change the file system. Windows PCs cannot read HFS+ disks without help, so a raw disk is only a step. 7-Zip or Sleuth Kit then lists the files.

Does a DMG file become an ISO file?

Many people ask for a DMG to ISO conversion. An ISO file stores an ISO 9660 file system, and most DMG files store HFS+ or APFS. So the raw disk from a normal DMG file is not an ISO file. Our hybrid DMG file did convert to a raw file that 7-Zip read as an ISO image, because it already contained one.

A converter converts, and a hash proves it

A conversion that finishes without an error has not proved anything. The dmg2img result on the LZFSE file shows why. Hash the raw output and compare it with the hash of your source disk. Without a source hash, compare the output size with the sector count in the trailer times 512.

Raw output is large. Raw disks are as big as the disks they copy, even when most of the space is empty. Our 3,216,834-byte DMG file became a 23,068,672-byte disk. Make sure you have the space.

What Else Looks Like a DMG File? .img, .smi, .sparseimage and endings that mislead

Not every file that looks like a DMG file is one. The older Mac OS 9 formats used .img and .smi, sparse images use their own endings, and ZIP and ISO files saved as .dmg still open in 7-Zip. Read the bytes before you choose a program.

The Wikipedia entry says Apple used the New Disk Image Format, or NDIF, as the default in Mac OS 9, before UDIF took over on Mac OS X. The table lists the endings we found in Wikipedia, in the libmodi documentation and in Apple's guide. We tested only the .dmg row.

Endings near the DMG file
Ending What it is
.dmg UDIF images, the standard
.img Also the ending of NDIF images from Mac OS 9, says Wikipedia
.smi Self-mounting image for Mac OS 9 and earlier, says Wikipedia
.sparseimage Sparse image that grows with its content, says the libmodi documentation
.sparsebundle Folder of band files, new in Mac OS X 10.5
.cdr DVD or CD master, listed by Apple's Disk Utility guide
.asif Apple Sparse Image Format, listed by Apple's Disk Utility guide

Endings that mislead

We gave a ZIP file and an ISO file the .dmg ending. 7-Zip opened both by their content, and libmodi opened the ISO file. dmg2img and qemu-img refused both. The web page saved as .dmg failed in all four readers. Programs that trust the ending would be fooled, and programs that read the bytes were not.

Floppy and old Mac images

Wikipedia says Disk Copy 4.2 was the format for floppy disk images, and DART was a similar format with compression. We made none of these. For PC floppy images, see the IMA file guide.

UDIF images The .dmg files in this guide. They end with the koly trailer.
Sparse images Files that grow as you add data. They are not UDIF files with a trailer.
Old Mac OS 9 images NDIF images with .img and .smi endings. We did not test them.
Not a DMG file at all ZIP files, ISO files or web pages with a .dmg name. Read the first bytes and the last 512.

What Is the DMG File Format Made Of? The facts we could check, and what we left out

The DMG format is not a published standard. These are the facts we could check against Wikipedia, FileInfo, Apple's guides, the libmodi documentation and our own 36 test files, plus the points we left out.

Facts about the DMG file format
Part What we could check
UDIF Universal Disk Image Format. Big endian, with the trailer at the end. Version 4 and header size 512, as in our files and in the sources we cite. Apple has not published it, says Wikipedia.
Property list XML, with a blkx array of base64 block tables. Our files had one table per partition.
Block table Starts with mish. A header of 204 bytes, then entries of 40 bytes.
Packing ADC, zlib, bzip2 (Mac OS X 10.4), LZFSE (10.11) and LZMA (10.15), says Wikipedia. We made all five.
Checksums One for the data, one for every block table and a master checksum. Our script used CRC-32, and our files passed their own check.
Encryption Version 1 puts its header at the end of the file. Version 2 puts it at the start and has been the default since OS X 10.5, says Wikipedia. Not tested.
Partition maps GUID table, Apple Partition Map or none. We made all three.
File systems HFS+, FAT32 and an ISO and HFS+ hybrid in our files. APFS is in Apple's guide, and we did not test it.
MIME type application/x-apple-diskimage, says Wikipedia
Apple type name com.apple.disk-image, says Wikipedia

About the values we list

The byte positions and entry types come from the libmodi documentation and the newosxbook write-up. We checked them against files that four readers opened. Those files came from our own Python writer and from libdmg-hfsplus, made on Ubuntu 24.04 in October 2026. A Mac may write other values, so treat our numbers as guides, not promises.

What we left out

We did not test any DMG file made by a Mac, encrypted DMG files, APFS volumes, sparse images, NDIF images or disks over 42 MiB. We did not use hdiutil, Disk Utility, Finder or Gatekeeper. Everything about them comes from Apple, from Wikipedia and from the hdiutil man page. Our LZMA file used an XZ container that no reader opened, so it may not match what Apple writes.

The SysTools and Freeviewer viewers come from their own pages, and we did not start either one. We name no prices. The macOS 27 note comes from Iru, which wrote about a beta man page, so check the final macOS 27 notes before you rely on it.

Our damage tests are simple breaks in small files. We tried four readers, and others may behave differently. Our repair script and our check script are research tools. Test them on copies before you trust them with anything that matters.

Sources checked

For the idea and uses, see the Wikipedia article on Apple Disk Image and the FileInfo page for the DMG ending. For Mac steps, see the Disk Utility User Guide and the page on unidentified developers. For deprecation news, see Iru, and for checksums, see Eclectic Light. For layout, see the newosxbook.com DMG page and the libmodi documentation.

Every test count came from the 36 DMG files and the scripts in our research folder.

Frequently Asked Questions About DMG Files

What is a DMG file?

DMG files are disk images that macOS opens as drives. Apple made the format, and software makers use it to hand out Mac apps. DMG files store the files and the disk layout around them, often packed with zlib, bzip2, LZFSE or LZMA. FileInfo calls them mountable disk images used mostly to distribute software to macOS.

How do I open a DMG file on a Mac?

Double-click it. macOS mounts the DMG file as a volume in Finder, and you can open the volume and install the app inside. If macOS warns about an unknown developer, Apple says to open System Settings, go to Privacy & Security and click Open Anyway. Apple adds that the safest approach is to find the app in the Mac App Store.

How do I open a DMG file on Windows or Linux?

Use 7-Zip. In our tests, it returned all four test files from 11 of 12 good DMG files, more than dmg2img, libmodi or qemu-img. It stopped only on our LZMA file. For a Linux mount, convert the DMG file to a raw disk first with dmg2img or qemu-img.

How do I know if a file is a DMG file?

Read the last 512 bytes. DMG files end with trailers that begin with the text koly. The first bytes change with the kind, and our 12 good files started nine different ways. A short Python script on this page finds the trailer and checks it.

Is a DMG file safe to open?

Opening DMG files to look inside is low risk. Starting an app from one executes that app's code. Apple says that overriding security settings is a common way Macs get infected. Install only apps you trust, and compare the hash with the one from the vendor.

Why does my Mac say a DMG file is damaged or will not mount?

Read-only and compressed DMG files store a checksum. Eclectic Light says a mismatch probably means damage, so download a fresh copy. The file system inside can also be damaged while the checksum matches. We did not test this on a Mac, so treat it as a hint only.

How do I make a DMG file?

On a Mac, open Disk Utility, choose File, New Image, then Image from Folder and choose the format. Terminal users can use hdiutil create. Iru reported that the macOS 27 beta man page marks hdiutil as deprecated in favor of diskutil image, and that hdiutil still works. Hash the new file right away.

How do I check that a DMG file is not damaged?

Compare its hash with the one on the download page. On a Mac, hdiutil verify checks the stored checksum of read-only and compressed images. In our tests, a flipped bit in an uncompressed DMG file passed all four readers, and only a stored checksum or hash found it.

Why will my DMG file not open?

The usual cause is a damaged trailer. Cut it, zero it or change the letters koly, and every reader we tried refused the DMG file. In our 24 damaged files, a reader returned all four files from 6 as they were and from 6 more after one repair. Seven gave three files, and five gave nothing.

Can I convert a DMG file to ISO or to a raw disk?

You can convert DMG files to raw disks with dmg2img or qemu-img. For seven good files, our raw disk had the same SHA-256 hash as the disk we started from. ISO files use a different file system, so a DMG file becomes an ISO file only when it already contains an ISO 9660 image, like our hybrid test file.

Is a DMG file the same as an ISO file?

No. DMG files are Apple's disk images and usually contain HFS+ or APFS volumes. An ISO file is a copy of an optical disc in the ISO 9660 format. A DMG file can contain an ISO image, and 7-Zip can open both. The ending alone does not show which one you have.

Is there a free DMG viewer for Windows?

SysTools and Freeviewer both describe a Windows viewer for DMG files. Both say the trial or demo only previews, and saving needs the paid version. We did not start either one, so read the limits on their pages first. 7-Zip is free and opened 11 of our 12 good files.

Still Stuck With a DMG File? Seven routes out, depending on what went wrong

Your DMG file will not open

Start with the damage grid. A cut trailer or a typo in koly explains many cases, and small byte edits fix them.

You want to trust a download

Go to how to hash DMG files. A hash from the source is the only check that catches a flipped bit in a raw file.

Is it another kind of disk image? The full disk image guide covers ISO, VHD, VMDK, QCOW2 and E01 files. The VHD virtual disk guide and the VMDK virtual disk guide go deeper on two of them.

Is it a raw copy of a disk? The dd disk copy guide explains the dd tool and the raw format.

Is it an archive? See the ZIP archive guide and the RAR archive guide.

Is it an old floppy image? The floppy image guide explains the IMA format.

Is it a file type you do not know? Browse the file extension resource library, or send it to us on the submit a file type page.