XAR(1) User Commands XAR(1)

xar - eXtensible ARchiver

xar is no longer under active development by Apple. Clients of xar should pursue alternative archive formats.

xar -[ctx][v] ...

The XAR project aims to provide an easily extensible archive format. Important design decisions include an easily extensible XML table of contents (TOC) for random access to archived files, storing the TOC at the beginning of the archive to allow for efficient handling of streamed archives, the ability to handle files of arbitrarily large sizes, the ability to choose independent encodings for individual files in the archive, the ability to store checksums for individual files in both compressed and uncompressed form, and the ability to query the table of content's rich meta-data.

Creates an archive
Lists the contents of an archive
Extracts an archive
The filename to use for creation, listing or extraction. With extraction, this can be a POSIX regular expression.

Specifies the compression type to use. Valid values: none, gzip, bzip2, lzma (on some systems). Default value: gzip
On extract, xar will chdir to the specified path before extracting the archive.
Synonym for --compression=lzma
Synonym for --compression=bzip2
Synonym for --compression=gzip
Specifies arguments to the compression engine selected. gzip, bzip2, and lzma all take a single integer argument between 0 and 9 specifying the compression level to use.
Has xar dump the xml header into the specified file. "-" can be specified to mean stdout.
Dumps the ToC checksum to stdout along with the algorithm of the ToC.
Has xar print out the xar binary header information to stdout.
Extracts the specified subdocument to a document in cwd named <name>.xml
List the subdocuments in the xml header
Specifies the hashing algorithm to use for xml header verification. Valid values: md5 (on some systems), sha1, sha256, and sha512. Default value: sha1
Specifies the hashing algorithm to use for file content verification. Valid values: md5 (on some systems), sha1, sha256, and sha512. Default value: sha1
On archival, stay on the local device.
On extract, set ownership based on uid/gid. If the uid/gid can be set on the extracted file, setuid/setgid bits will also be preserved.
On extract, set ownership based on symbolic names, if possible. If the uid/gid can be set on the extracted file, setuid/setgid bits will also be preserved.
On extract, specifies the file to extract subdocuments to. On archival, specifies an xml file to add as a subdocument.
Verbose output
Specifies a POSIX regular expression of files to exclude from adding to the archive during creation or from being extracted during extraction. This option can be specified multiple times.
Specifies a size (in bytes) for the internal libxar read buffer while performing I/O.
When multiple files in the archive are identical, only store one copy of the data in the heap. This creates smaller archives, but the archives created are not streamable.
When the data section of multiple files are identical, hardlink them within the archive.
Specifies a POSIX regular expression of files to archive, but not compress. The archived files will be copied raw into the archive. This can be used to exclude already gzipped files from being gzipped during the archival process.
Specifies a file property to be included in the archive. When this option is specified, only the specified options will be included. Anything not specifically included with this option will be omitted. This option can be used multiple times.
Specifies a file property to be excluded from the archive. When this option is specified, all file properties will be included except the specified properties. This option can be used multiple times.
Creates an archive to only contain file properties safe for file distribution. Currently, only name, type, mode, and data are preserved with this option.
Does not overwrite existing files during extraction. Keeps any previously existing files while extracting.
Synonym for --keep-existing.
When extracting without -p or -P options, xar will extract files as the uid/gid of the extracting process. In this situation, xar will strip setuid/setgid bits from the extracted files for security reasons. --keep-setuid will preserve the setuid/setgid bits even though the uid/gid of the extracted file is not the same as the archived file.

Create a xar archive of all files in /home/uid
List the contents of the xar archive sample.xar
Extract the contents of sample.xar to the current working directory

Rob Braun <bbraun AT synack DOT net>
Landon Fuller <landonf AT bikemonkey DOT org>
David Leimbach
Kevin Van Vechten

June 4, 2015 version 1.8