Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:AppleSingle and AppleDouble

From ReverseEngineering.wiki
Format
On this wiki Facts · Code · Notes · Topics

Apple's container for the two forks and Finder metadata: magic 0x00051600 (AppleSingle, both forks in one file) or 0x00051607 (AppleDouble, a '._' or '%' companion file holding the resource fork and metadata), version 0x00020000, a 26-byte header and 12-byte entry descriptors.

Overview

A header, then a table of entries, then the entry data. AppleSingle puts everything in one file; AppleDouble leaves the data fork in the ordinary file and stores the resource fork and the Finder/Mac metadata in a companion file (named with a '._' prefix on macOS, '%' prefix or a .rsrc/.AppleDouble folder in older tools). See Format:Mac resource fork, Format:MacBinary, Platform:Classic Mac OS.

Header

From XADMaster XADAppleSingleParser.m (LGPL-2.1, lines 38-72): u32 magic 0x00051600 (AppleSingle) or 0x00051607 (AppleDouble), u32 version 0x00020000, 16 more bytes (the parser skips 20 bytes after the magic: version and filler), u16 number of entries, then that many entries of three u32 (entry id, offset, length), all big-endian. The recognizer also accepts the byte-swapped magics 0x00160500 and 0x07160500 with version 0x00000200 and then reads every field little-endian (lines 38-40, 53-54), but the date entry stays big-endian (the code comments on this).

Entry ids seen in the parser

1 data fork, 2 resource fork, 3 real name, 4 comment, 8 dates (u32 creation, modification, backup, access, big-endian seconds counted from 2000-01-01), 9 Finder info (32 bytes; when longer than 70 bytes the extended attributes follow it, which is how macOS stores its xattrs). Unverified (from the specification, not the parser): 5 black-and-white icon, 6 colour icon, 7 file info (older), 10 Macintosh file info, 11 ProDOS file info, 12 MS-DOS file info, 13 AFP short name, 14 AFP file info, 15 AFP directory ID.

Identification

First 8 bytes 00 05 16 07 00 02 00 00 = AppleDouble, 00 05 16 00 00 02 00 00 = AppleSingle.

Code & repositories

  • https://github.com/MacPaw/XADMaster @ 7cb9ee0abbb163f261e4cb74501e15067032319c · license: LGPL-2.1
    The Unarchiver's engine (Objective-C, LGPL-2.1): recognisers and parsers for MacBinary, AppleSingle/Double, BinHex and StuffIt 1-5.
    Tested on: source read, not run: read the source only · checked 2026-10-19; last activity 2026-09-21