BSD tar on macOS silently embeds ._ AppleDouble files and LIBARCHIVE.xattr.* extended headers in tarballs, causing warnings and junk files on Linux extraction.
Key Takeaways
macOS bsdtar adds ._ resource fork files and xattrs like com.apple.quarantine and com.apple.lastuseddate#PS to every archived file by default.
Fix at creation time: tar --no-xattrs or tar --disable-copyfile suppresses the extra files without changing anything else.
Permanent fix: install gnu-tar via Homebrew and prepend its path (/opt/homebrew/opt/gnu-tar/libexec/gnubin) to $PATH so all tar invocations use GNU tar.
Apple Silicon path differs from Intel: /opt/homebrew/... vs /usr/local/opt/....
Hacker News Comment Review
Commenters note this is intentional Apple design: bsdtar preserves full filesystem semantics including Finder metadata and Gatekeeper quarantine flags, prioritizing Mac round-trip fidelity over cross-platform portability.
A technical thread highlights that GNU tar supports SCHILY.* xattr encoding but not LIBARCHIVE.*, while bsdtar >= 3.7.2 now writes both for maximum compatibility, a nuance the article omits.
Consensus among cross-platform builders: add --no-xattrs --no-mac-metadata to deploy scripts rather than relying on system tar defaults.
Notable Comments
@LatencyKills: Ex-Apple engineer confirms behavior mirrors copyfile(3) and Archive Utility; Apple treats tar as a full filesystem archive, not a portable interchange format.
@throw0101a: Points to detailed 2018 portability analysis showing GNU tar / SCHILY vs LIBARCHIVE xattr encoding split and bsdtar 3.7.2 dual-encoding fix.