Skip to content

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

.dmg file signature | application/octet-stream

Macintosh encrypted Disk image (v1)

High

Magic Bytes

Offset 0
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 0 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/octet-stream

Byte Offset

0

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 magic bytes."""
    signature = bytes([0x6B, 0x6F, 0x6C, 0x79])
    with open(file_path, "rb") as f:
        return f.read(4) == signature

How to validate .dmg files in Node.js

Node.js
function isDMG(buffer: Buffer): boolean {
  const signature = Buffer.from([0x6B, 0x6F, 0x6C, 0x79]);
  return buffer.subarray(0, 4).equals(signature);
}

How to validate .dmg files in Go

Go
func IsDMG(data []byte) bool {
    signature := []byte{0x6B, 0x6F, 0x6C, 0x79}
    if len(data) < 4 {
        return false
    }
    return bytes.Equal(data[:4], signature)
}

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .dmg file?

A .dmg file is a Mac OS X Disk Copy Disk Image file file. Macintosh encrypted Disk image (v1)

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 at byte offset 0. 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 first bytes of the file and compare them against the known magic bytes (6B 6F 6C 79) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .dmg files?

There is no officially registered MIME type for .dmg files. Systems typically use application/octet-stream as a generic fallback when handling this format.

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.