How Unrar Handles Alternate Data Streams on macOS

This article explains how the unrar command-line utility processes RAR archives containing Alternate Data Streams (ADS) when executed on macOS. While ADS is a feature native to the Windows NTFS filesystem, macOS utilizes its own extended attribute system on APFS and HFS+. When extracting archives on macOS, unrar generally ignores or discards Windows-originating NTFS streams due to filesystem incompatibilities, though it provides distinct mechanisms for handling native macOS extended attributes and resource forks.

The Incompatibility Between NTFS ADS and macOS

Alternate Data Streams are an NTFS-specific mechanism that allows files to store multiple streams of data under a single directory entry. On Windows, WinRAR and the rar CLI tool can pack these streams using the -os (Save NTFS streams) switch.

macOS, however, uses the Apple File System (APFS) or Hierarchical File System Plus (HFS+). Instead of NTFS-style named streams, macOS relies on extended attributes (xattr) and historically on resource forks. Because the Unix and macOS builds of unrar rely on standard POSIX filesystem APIs and specific macOS system calls rather than the Windows Win32 API, there is no direct, automatic translation between NTFS Alternate Data Streams and macOS extended attributes.

Default Extraction Behavior

When you use unrar to extract an archive on macOS:

  1. NTFS Alternate Data Streams Are Ignored: If the RAR archive was created on a Windows system with the -os flag to include NTFS streams, unrar on macOS will extract only the primary data stream (the main file content). The secondary alternate streams are skipped and will not be written to the disk.
  2. No Fallback File Creation: Unlike some archiving tools that might extract alternate streams as separate companion files (such as filename:streamname or AppleDouble ._filename files), standard unrar does not decompose NTFS streams into standalone files on non-Windows platforms.
  3. No Extraction Errors: The extraction process typically completes successfully without throwing fatal errors. The utility silently bypasses the unsupported NTFS stream metadata, preserving the integrity of the primary file payload.

Handling Native macOS Streams and Attributes

While unrar discards Windows NTFS streams on macOS, it does have dedicated support for macOS-specific extended attributes and resource forks:

  • The -om Switch: When creating archives on macOS using rar, the -om flag instructs the tool to save native extended attributes and resource forks.
  • Restoration on macOS: If an archive containing macOS-native metadata saved via -om is extracted on macOS, unrar will properly restore these extended attributes using macOS system APIs.
  • Archive Inspection: You can verify whether an archive contains extra stream data by running unrar v archive.rar or unrar l -v archive.rar to inspect file headers and metadata flags prior to extraction.

Preserving NTFS Streams from macOS

If access to the information stored inside NTFS Alternate Data Streams is strictly required on macOS, unrar cannot perform the necessary mapping natively. The archive must either be extracted within a Windows environment (such as a Windows virtual machine) or processed using custom extraction scripts that can read raw RAR structures and manually write the stream contents into macOS extended attributes using the xattr utility.