Make and open Apple Archive (.aar) files on a Mac
With Archive Utility
Archive Utility opens .aar files: double-click one and it expands next to
the archive, like a ZIP. To make them, change one setting:
- Open Archive Utility. It’s in
/System/Library/CoreServices/Applications/; the quickest way is to type “Archive Utility” in Spotlight. - Choose Archive Utility ▸ Settings, and set Use archive format to Apple Archive.
- Choose File ▸ Create Archive…, select the folder, and click
Archive. The
.aarappears next to the folder.
Finder’s Compress command makes a ZIP; I didn’t test whether this
setting changes that. The other choices in the menu are
“compressed archive” (a .cpgz), “regular archive” (a .cpio), ZIP, and
Apple Encrypted Archive, covered on the next
page.
With the aa command
aa makes, lists and extracts Apple Archives:
aa archive -D ~/Projects/Site -o ~/Desktop/Site.aar
aa list -i ~/Desktop/Site.aar
mkdir -p ~/Desktop/Restored
aa extract -i ~/Desktop/Site.aar -d ~/Desktop/Restored-Dkeeps the folder’s name inside the archive, so it extracts asRestored/Site/…. With-dinstead, only the folder’s contents go in.-apicks the compression:lzfse(the default),lzma,lzraven,zlib,lz4,lzbitmap, orrawfor none.aa list -vshows each entry’s owner, permissions, flags and times.
Which compression to use
I archived two folders with each method and took the median of three runs. One is a website project: 673 files, 48.5 MB, mostly WebP and PNG images, which are already compressed. The other is a folder of source code and documentation: 4,444 text files, 73.6 MB.
aa -a | Source code: size | Time to make | Time to extract | Website: size |
|---|---|---|---|---|
raw | 74.4 MB | 0.35 s | 0.29 s | 48.7 MB |
lz4 | 7.7 MB | 0.34 s | 0.28 s | 46.3 MB |
lzbitmap | 6.4 MB | 0.40 s | 0.31 s | 45.9 MB |
zlib | 4.7 MB | 0.42 s | 0.28 s | 45.8 MB |
lzfse (default) | 4.3 MB | 0.39 s | 0.27 s | 45.0 MB |
lzraven | 3.3 MB | 1.33 s | 0.28 s | 44.1 MB |
lzma | 3.2 MB | 1.57 s | 0.30 s | 43.8 MB |
Keep the default. lzfse was about as fast as no compression at all,
and made the source code 17 times smaller. lzma and lzraven saved another
quarter for three to four times the wait, and extracted just as fast, so they’re
worth it for something you’ll keep a long time. On the images, no method
saved much: they were already compressed.
For comparison, on the same source code folder a .tar.gz was 5.0 MB and
took 2.4 s, and a ZIP from zip -r was 6.3 MB in 0.7 s. The comparison
page has the rest.
What it keeps
A Mac file can carry more than its contents: extended attributes (where Finder tags, “Where from” and quarantine flags live), a resource fork, permission lists (ACLs), file flags such as “hidden”, and hard links. I made a test folder with each of these, archived it in every built-in format, and extracted it again on the same Mac:
| Format | Extended attributes and tags | ACLs | Hidden flag | Hard links | Symbolic links |
|---|---|---|---|---|---|
Apple Archive (aa or Archive Utility) | ✓ | ✓ | ✓ | ✓ | ✓ |
tar (macOS’s own, both ends) | ✓ | ✓ | ✓ with tar -xpf | ✓ | ✓ |
.cpgz from ditto | ✓ | ✓ | ✗ | ✓ | ✓ |
Disk image (diskutil image) | ✓ | ✓ | ✓ | ✗ | ✓ |
| Finder-style ZIP, opened on a Mac | ✓ | ✓ | ✗ | ✗ | ✓ |
Finder-style ZIP, opened with unzip | ✗ | ✗ | ✗ | ✗ | ✓ |
zip -ry | ✗ | ✗ | ✗ | ✗ | ✓ |
| 7z | ✗ | ✗ | ✗ | ✗ | ✓ |
Every format kept the modification time, the “executable” permission, empty
folders, and a name with an accent. A Finder-style ZIP keeps Mac metadata in
a hidden __MACOSX folder, which only Mac tools put back; unzip and other
systems extract it as a stray folder. Apple Archive and macOS’s own tar were the
only formats that kept everything, and Apple Archive was several times
faster. tar kept the hidden flag only when I extracted with tar -xpf;
plain tar -xf dropped it.
What can’t open it
Only Apple’s tools read Apple Archive. On this Mac, tar, 7-Zip (7zz)
and The Unarchiver’s command-line tool (unar) all said they didn’t
recognize a .aar file, and aa itself doesn’t read ZIP or tar files.
Send a ZIP to anyone not on a Mac.