Mac OS X Disk Copy Disk Image file
application/octet-stream
⚠️
High Risk Format
This file type can contain executable code. Always validate source and scan with antivirus before opening.
Magic Bytes
Offset: 0
6B 6F 6C 79
Apple Disk Image (DMG) is a proprietary disk image format created and maintained by Apple Inc. for the macOS operating system. It functions as a mountable virtual container primarily used for software distribution, application installation, and structured data storage across Apple platforms. Since these files can execute system-level scripts and deliver binary payloads upon mounting, they present a high security risk and require rigorous digital signature verification from trusted sources.
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);
}
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