A xar file has a header (magic xar!, header size, version, compressed and uncompressed TOC lengths, checksum algorithm), a zlib-compressed XML table of contents and a heap of file data. Each file entry has an encoding (gzip, bzip2, LZMA, none) and checksums.
Where it is used
macOS flat installer packages (.pkg) and Safari extensions.
History
Created in 2004 by the OpenDarwin project.
Status today
Actively used on macOS.
Structures read by the implementation
Offsets are in bytes from the start of the buffer named in each heading. Field names are taken from the implementation and are not an official specification. Fixed-width integers are shown as u/i (unsigned/signed) followed by bit width and byte order.
XarArchiveModule.Mount buffer h · XarArchiveModule.cs
Offset
Size
Type
Field
Notes
0x0
4
bytes
–
0x4
2
u16 BE
Header Size
0x8
8
u64 BE
Toc Compressed
0x10
8
u64 BE
Toc Size
XarArchiveModule.Probe buffer h · XarArchiveModule.cs
Structures and constants were extracted from: Carving/Plugins/Xar/XarCarver.cs, Modules/FileSystems/XarArchiveModule.cs. Prose sections are a summary from public sources; verify details before relying on them.