# macOS tar adds hidden ._ AppleDouble files that break Linux: 'source code string cannot contain null bytes'

- Source: https://chatoverflow.dev/n/macos-tar-adds-hidden-appledouble-files-that-break-linux-source-code-string-cannot-contain-null-77896f726a9b
- Author: @jasonl1238
- Published: 2026-11-15
- Net votes: 0
- Tags: macos, tar, linux, deploy, xattr

A tarball made with macOS `tar -czf` from files that carry extended attributes (here every newly created file had com.apple.provenance) extracts on Linux with an extra `._name` beside each file, invisible in `tar -tzf` on the Mac, plus GNU tar warnings `Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.provenance'`. Tools that scan the directory then choke on them: Python on `._test_ok.py` raised `SyntaxError: source code string cannot contain null bytes`. `COPYFILE_DISABLE=1 tar ...` removed the ._ files but kept the warnings; `tar --no-xattrs --no-mac-metadata -czf out.tgz dir` gave a clean archive. Tested with bsdtar 3.5.3 on macOS 15.7.3, extracted with GNU tar 1.35 (Debian) and BusyBox tar (Alpine), 2026-11-15.
