Skip to content

Mac OS X Disk Copy Disk Image file (.dmg)

.dmg file signature | application/x-apple-diskimage

Mac OS X Disk Copy Disk Image (DMG) is a disk image format created and maintained by Apple for macOS. It is used to distribute applications, install software, package files, and mount virtual volumes in Finder or Disk Utility. Originally associated with Apple Disk Copy utilities, it remains common on macOS, but disk images can carry malware or encrypted content and should be opened only from trusted sources.

High

Magic Bytes

End of file
6B 6F 6C 79

Sources: Wikipedia

All Known Signatures

5 signature variants are documented for .dmg files across multiple sources.

Hex Signature Offset Sources
6B 6F 6C 79 End of file Wikipedia
42 5A 68 0 Gary Kessler
63 64 73 61 65 6E 63 72 0 Gary Kessler
65 6E 63 72 63 64 73 61 0 Gary Kessler
78 01 73 0D 62 62 60 0 Gary Kessler

Extension

.dmg

MIME Type

application/x-apple-diskimage

Position

End of file

Risk Level

High

Validation Code

How to validate .dmg files in Python

Python
def is_dmg(file_path: str) -> bool:
    """Check if file is a valid DMG by trailer magic bytes."""
    signature = bytes([0x6B, 0x6F, 0x6C, 0x79])
    with open(file_path, "rb") as f:
        f.seek(-512, 2)
        return signature in f.read(512)

How to validate .dmg files in Node.js

Node.js
function isDMG(buffer: Buffer): boolean {
  const signature = Buffer.from([0x6B, 0x6F, 0x6C, 0x79]);
  const start = Math.max(0, buffer.length - 512);
  return buffer.subarray(start).includes(signature);
}

How to validate .dmg files in Go

Go
func IsDMG(data []byte) bool {
    signature := []byte{0x6B, 0x6F, 0x6C, 0x79}
    start := 0
    if len(data) > 512 {
        start = len(data) - 512
    }
    return bytes.Contains(data[start:], signature)
}

API Endpoint

GET /api/v1/dmg
curl https://filesignature.org/api/v1/dmg

See the full API documentation for all endpoints and parameters.

Related Formats

Frequently Asked Questions

What is a .dmg file?

A .dmg file is a Mac OS X Disk Copy Disk Image file file. Mac OS X Disk Copy Disk Image (DMG) is a disk image format created and maintained by Apple for macOS. It is used to distribute applications, install software, package files, and mount virtual volumes in Finder or Disk Utility. Originally associated with Apple Disk Copy utilities, it remains common on macOS, but disk images can carry malware or encrypted content and should be opened only from trusted sources.

What are the magic bytes for .dmg files?

The magic bytes for Mac OS X Disk Copy Disk Image file files are 6B 6F 6C 79 in the last 512 bytes (file trailer). These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .dmg file?

To validate a .dmg file, read the last 512 bytes of the file and scan for the known magic bytes (6B 6F 6C 79). This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .dmg files?

The primary MIME type for .dmg files is application/x-apple-diskimage.

Is it safe to open .dmg files?

Mac OS X Disk Copy Disk Image file (.dmg) files are high risk because they can contain executable code. Never open .dmg files from untrusted sources. Always scan with antivirus software, verify the source, and consider running in a sandboxed environment.