Why tar Can't Restore Mac Extended Attributes on Linux

We built a Mac-style tar archive by hand, extracted it on a real Linux box, and traced the exact kernel call that rejects it, down to the single attribute name.

By Ram Velmurugan · Founder & Lead Developer, 1dot.ai

Quick X Folder Preview · TroubleshootingTested and checked live Nov 25, 2026·10 min read
Quick answer: The error is real, and it isn't a sign anything broke. macOS stores its own metadata as extended attributes named com.apple.*, and Linux only accepts attribute names under four fixed namespaces: user, trusted, security, and system. com.apple.* isn't one of them, so the kernel refuses to store it and GNU tar prints Operation not supported. The file itself extracts intact either way. If you want the message gone, restrict what tar tries to restore with --xattrs-include='user.*' or exclude the Apple names explicitly, both covered below.

Editorial note: 1dot.ai makes Quick X Folder Preview, a folder and archive preview app for Mac mentioned near the end of this guide. It plays no role in tar, extended attributes, or anything tested below. Every command here ran in a Linux container (Ubuntu 24.04.5 LTS, GNU tar 1.35), not on a Mac, since that is the platform this error actually shows up on. We did not have bsdtar available in this session, so we built the archive's pax headers by hand in Python, in the same per-file pax format bsdtar writes, and checked the behavior against the GNU tar manual, the Linux kernel source, and libarchive's pax writer. This is a companion piece to our earlier post on why COPYFILE_DISABLE does nothing on Linux, which covers a different tar/Mac metadata mismatch. Checked live on November 25, 2026.

The Short Version

You extracted a tarball that came from a Mac, maybe a backup, a release artifact, or a project someone zipped up and tarred for you, and GNU tar printed something like:

tar: setxattrat: Cannot set 'com.apple.quarantine' extended attribute for file 'photo.jpg': Operation not supported

The archive isn't corrupted and the extraction didn't stop. Something far more specific happened: tar read one piece of Mac-only metadata out of the archive, tried to reattach it to the extracted file, and the Linux kernel refused, because the name of that metadata doesn't fit any category Linux recognizes. We reproduced the exact message on November 25, 2026, traced the real system call behind it with strace, and worked out which tar flags make the warning disappear without quietly dropping attributes you'd actually want kept.

We Built the Archive and Reproduced the Error

This session's container has no Mac, and we couldn't install bsdtar either (the package manager refused the install under this session's own guardrails). So rather than restate what other articles say macOS-made archives contain, we built one ourselves, matching the real pax extended-header format bsdtar actually writes, using Python's tarfile module:

$ python3 - <<'PY'
import tarfile, os
os.makedirs("src", exist_ok=True)
with open("src/one.txt", "wb") as f:
    f.write(b"data")

t = tarfile.open("fixed.tar", "w", format=tarfile.PAX_FORMAT)
ti = t.gettarinfo("src/one.txt", arcname="one.txt")
ti.pax_headers = {
    "SCHILY.xattr.user.onlyone": "just-one-value",
    "SCHILY.xattr.com.apple.quarantine": "0081;deadbeef;Safari;GUID",
}
with open("src/one.txt", "rb") as f:
    t.addfile(ti, f)
t.close()
PY

$ tar --xattrs --xattrs-include='*' -xvf fixed.tar -C out
one.txt
tar: setxattrat: Cannot set 'com.apple.quarantine' extended attribute for file 'one.txt': Operation not supported
$ echo "exit: $?"
exit: 0

Two attributes went in, one Linux-safe (user.onlyone) and one Apple-only (com.apple.quarantine, the same attribute macOS sets on anything downloaded from the internet). One restored cleanly. The other produced the exact error reported in the wild, on Ubuntu 24.04.5 LTS with GNU tar 1.35, and the process still exited 0, meaning this did not fail the extraction as a whole.

A Dead End First: a Global Header GNU tar Misreads

Our first attempt at building this archive used a shortcut: passing pax_headers directly to tarfile.open() instead of to each file's own TarInfo. That produced a different, uglier error:

tar: setxattrat: Cannot set '' extended attribute for file 'one.txt': Operation not supported

An empty attribute name. We almost wrote that off as the real behavior, since it still looked like a failure related to extended attributes. Running the extraction under strace -e trace=setxattr showed what tar actually tried to do:

setxattr("doc.txt", "\177", "this-should-work", 16, 0) = -1 EOPNOTSUPP (Operation not supported)

The attribute name tar passed to the kernel was a single byte, \177 (the DEL character), not user.realtest, the key we set. That is not a Linux namespace problem. It comes from where the record sat in the archive: tarfile.open(..., pax_headers=...) writes a global extended header (typeflag g, name ./@PaxHeader), which applies to every subsequent member in the archive, not the per-file local header (typeflag x) that real tar implementations use for a single file's xattrs. Python wrote a valid global header (its documentation says pax_headers on TarFile becomes a pax global header). GNU tar 1.35 is the one that mishandles an xattr record found there: it passed a garbage name instead of applying the attribute. Setting pax_headers on the TarInfo object instead, as shown above, writes a local header and produces the real, correctly named error. If you build test archives with Python's tarfile and expect GNU tar to restore per-file xattrs, put them on each TarInfo.

Why Linux Rejects com.apple.* Specifically

Linux's extended attributes are organized into four namespaces:

NamespaceWhat it's for
userAttributes any process owning the file can set, the one ordinary tools use
trustedVisible and settable only with CAP_SYS_ADMIN, used by system tools
securityReserved for the kernel's own security modules, like SELinux contexts
systemUsed by the kernel itself for things like POSIX ACLs

When a program sets an attribute, the kernel (fs/xattr.c) looks for a handler whose prefix matches the name among the handlers the filesystem registered. If none matches, it returns EOPNOTSUPP without storing anything. ext4, XFS, Btrfs and tmpfs register handlers only for user., trusted., security. and system., so com.apple.quarantine is rejected on all of them, on a real disk or in a container. FUSE mounts are the exception: FUSE registers one catch-all handler with an empty prefix and hands any name to the userspace filesystem, which may accept it.

We checked that tar was not the cause by taking it out of the loop. With Python's os.setxattr() on this session's ext4 disk, user.test set and read back with no error. com.apple.quarantine failed with [Errno 95] Operation not supported, on ext4 and again on tmpfs at /dev/shm.

Why macOS gets away with it
Apple's own kernel, XNU, doesn't enforce this four-namespace rule the same way.com.apple.* attributes are a convention Apple's own tools follow, not a category the Darwin kernel validates against a fixed list the way Linux does. That asymmetry, not a bug in either operating system, is why this breaks going from Mac to Linux. A Linux user.* name is just another name to macOS.

Five Extraction Commands, Five Different Outcomes

We ran all five against the same archive on November 25, 2026, to map out exactly when the warning appears and when it doesn't:

CommandWhat actually happened
tar -xf archive.tarNo attempt at all
tar --xattrs -xf archive.tarRestores user.* only, others skipped silently
tar --xattrs --xattrs-include='*' -xf archive.tarTries every namespace, errors loudly on com.apple.*
tar --xattrs --xattrs-include='user.*' -xf archive.tarRestores only what Linux accepts, no error possible
tar --xattrs --xattrs-include='*' --xattrs-exclude='com.apple.*' -xf archive.tarTries everything except the names guaranteed to fail

The pattern worth remembering: --xattrs by itself is quiet, because the GNU tar manual specifies that only the user namespace is restored by default even with the option enabled. The warning only shows up once you explicitly widen the filter with --xattrs-include='*', telling tar to attempt everything in the archive, Apple metadata included, and then report back honestly when the kernel says no.

The Fix, Depending on What You Actually Want

Just want the files, nothing else

Do nothing extra. tar -xf archive.tar never requests extended-attribute restoration in the first place, since --no-xattrs is the default. No flag, no warning, no missing file content either way.

Simplest, zero new flags

Want your own custom attributes back, nothing from macOS

tar --xattrs --xattrs-include='user.*' -xf archive.tar restores only the namespace Linux actually supports. Anything under com.apple.* is never attempted, so there's nothing for the kernel to reject.

Clean, no warnings possible

Want everything tar can restore, minus the guaranteed failures

tar --xattrs --xattrs-include='*' --xattrs-exclude='com.apple.*' -xf archive.tar tries every namespace present in the archive except the one you already know will fail. We tested this against the same archive that triggers the error unfiltered: silent, clean extraction.

Most thorough, still quiet

Search around this error and you'll run into a related but distinct message, Ignoring unknown extended header keyword. That one happens earlier in the process: it's GNU tar failing to even recognize the name of a pax header field, most often LIBARCHIVE.xattr.*, a keyword bsdtar writes that GNU tar 1.35, the current release, still does not read. Our COPYFILE_DISABLE post shows bsdtar writing that keyword and SCHILY.xattr.*, which GNU tar does read, for the same attribute. libarchive's pax writer does this by default (its source sets both WRITE_LIBARCHIVE_XATTR and WRITE_SCHILY_XATTR). The error this post is about happens one step later: tar parsed the header and understood the attribute's name and value. The kernel is the one saying no, to one specific name, not to the header format.

Because a bsdtar archive carries both keywords, you can get both messages from one file. We built an entry with both records for com.apple.quarantine and extracted it with --xattrs-include='*.*', the pattern the Gentoo handbook uses when unpacking a stage3 archive:

$ tar --xattrs --xattrs-include='*.*' -xf lib.tar -C out
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.quarantine'
tar: setxattrat: Cannot set 'com.apple.quarantine' extended attribute for file 'one.txt': Operation not supported
$ tar --warning=no-unknown-keyword --xattrs --xattrs-include='*.*'       --xattrs-exclude='com.apple.*' -xf lib.tar -C out2
$ echo $?
0

--xattrs-exclude='com.apple.*' removes the second line only. The first goes away with --warning=no-unknown-keyword. Both are cosmetic: the file extracted intact in every run.

Does This Affect Our Own Apps?

No, and we'd rather state that plainly than let it sit unanswered. Quick X Folder Preview shows you what's inside an archive from the space bar before you extract it, useful for spotting unexpected files, but it has no involvement in extended attributes or how a Linux box handles them after extraction. Files Magic AI's System Cleaner targets unused apps, old installers, and developer caches on your own Mac, nothing to do with archives moving to Linux. If a CI job or a server is the one printing this warning, the tar flags above are the actual fix, not either product.

Sources & Further Reading

GNU tar's own documentation on the behavior: the GNU tar manual's Extended File Attributes section, which states that --no-xattrs is the default, that --xattrs stores or restores attributes under the POSIX.1-2001 (pax) format, that only the user namespace is restored on extraction by default, and documents --xattrs-include and --xattrs-exclude as sequential filters applied to the attribute set.

A public report showing that real macOS-made archives carry com.apple.* attributes in their pax headers (it shows the "Ignoring unknown extended header keyword" warnings for com.apple.quarantine and others): "Tar Files Created on macOS Display Errors When Extracting on Linux" (December 2024). We did not find a public report of the exact "Cannot set" message; the transcripts above are our own.

Kernel and library source, read November 25, 2026: Linux fs/xattr.c (handler lookup returns EOPNOTSUPP when no prefix matches), Linux fs/fuse/xattr.c (one handler with an empty prefix), and libarchive archive_write_set_format_pax.c (both xattr keywords written by default). The --xattrs-include='*.*' pattern is from the Gentoo AMD64 handbook's stage3 step.

Version banners in this post were read directly from tar --version (GNU tar 1.35) and /etc/os-release (Ubuntu 24.04.5 LTS) in this session's own container on November 25, 2026. The strace output and the extended attribute checks via Python's os.setxattr/os.getxattr were run the same day, in the same container.

Our related coverage: why COPYFILE_DISABLE does nothing when you tar on Linux, and what ._ files and the __MACOSX folder actually are in a zip archive.

Frequently Asked Questions

Why does tar say "Cannot set extended attribute ... Operation not supported" when I extract a tar archive made on a Mac?
Because macOS stores its own metadata, the quarantine flag, Finder tags, resource fork pointers, as extended attributes named with a com.apple. prefix, like com.apple.quarantine. Linux filesystems such as ext4, XFS, Btrfs and tmpfs only accept extended attribute names that start with one of four namespaces: user, trusted, security, or system. com.apple.quarantine doesn't start with any of them, so the setxattr() call tar makes during extraction returns EOPNOTSUPP, which GNU tar prints as "Operation not supported." We confirmed this with strace: once the attribute sat in a per-file header (see the dead end below), the failing call is setxattr(path, "com.apple.quarantine", ...), rejected cleanly by the kernel, not a corrupted archive.
Does this mean my files are lost or corrupted?
No. We diffed the extracted file against the original after triggering the error on purpose: identical bytes. The error is specific to one piece of metadata failing to reattach itself, not the file's actual content. By default, GNU tar does not even attempt to restore extended attributes during extraction (xattrs support is off unless you pass --xattrs), so most people extracting a Mac-made tarball on Linux never see this message at all, with nothing missing from the files themselves either way.
Why does the error only show up sometimes, not every time I extract a tar.gz from a Mac?
Because GNU tar's extended-attribute restore is opt-in and filtered twice. --no-xattrs is the default, so a plain tar -xf never tries to set anything. Pass --xattrs alone and, per the GNU tar manual, only the user namespace is restored by default, so a com.apple.* attribute is silently skipped with no error at all. The loud "Operation not supported" message only appears once you widen the filter yourself with --xattrs-include='*', telling tar to attempt every namespace in the archive, Apple's included, and then watch the kernel reject the one it can't store.
How do I stop the warning without losing attributes I actually care about?
If you only want attributes you set yourself, which are almost always in the user namespace, run tar --xattrs --xattrs-include='user.*' -xf archive.tar. That restores what Linux can actually hold and never touches the Apple-only names, so there's nothing to fail. If you want everything tar can restore but don't want the noise from what it can't, add an explicit exclude: tar --xattrs --xattrs-include='*' --xattrs-exclude='com.apple.*' -xf archive.tar. We tested both on November 25, 2026, against the same archive that triggers the error unfiltered: neither printed a warning.
Is this the same thing as the "Ignoring unknown extended header keyword" warning?
No, and the two get confused because they come from the same underlying archives. "Ignoring unknown extended header keyword" is GNU tar failing to recognize the pax header name itself, typically LIBARCHIVE.xattr.*, a keyword bsdtar writes that GNU tar, including the current 1.35, does not read. Our companion post on COPYFILE_DISABLE shows bsdtar writing that keyword next to SCHILY.xattr.*. "Cannot set ... extended attribute ... Operation not supported" is a different failure at a later stage: tar understood the header, extracted the attribute name and value just fine, and the Linux kernel itself refused to store it because of the namespace. One is a parsing gap. The other is a kernel-level naming rule. An archive from a Mac's bsdtar usually carries both keywords for the same attribute, so with --xattrs-include='*.*' you get both messages, one after the other. We reproduced that on November 25, 2026.
Does the filesystem matter, ext4 versus something else?
Mostly not. We confirmed extended attributes work on this session's ext4 filesystem by setting user.test with Python's os.setxattr and reading it back. Setting com.apple.quarantine the same way, with no tar involved, failed with the same Operation not supported on ext4 and on tmpfs (/dev/shm). In the Linux source (fs/xattr.c), the kernel looks up a handler for the name's prefix among the ones the filesystem registered, and returns EOPNOTSUPP when none matches. ext4, XFS, Btrfs and tmpfs register handlers only for the four standard prefixes, so they all reject it. FUSE is the exception: it registers a catch-all handler with an empty prefix and passes any name to the userspace filesystem, so on a FUSE mount the result depends on that filesystem.
Does Files Magic AI or Quick X Folder Preview fix this?
No, and we'd rather say that directly than leave it implied. Neither product touches tar, extended attributes, or archive extraction on Linux; both are Mac apps. Quick X Folder Preview lets you look inside an archive's contents from the space bar before extracting it, which tells you what files are in there but says nothing about which Linux namespace their attributes will land in once extracted elsewhere. Files Magic AI's System Cleaner clears unused apps, installers, and developer caches on your own Mac, a different job entirely. For the actual problem, the --xattrs-include and --xattrs-exclude flags above are the fix.

The Bottom Line

tar: Cannot set ... extended attribute ... Operation not supported is a correctly-working kernel refusing a correctly-read attribute name that simply doesn't fit Linux's four namespaces. We proved the file content survives untouched, traced the exact rejected system call with strace, and found that the warning only ever appears when you explicitly ask tar to restore every namespace in an archive with --xattrs-include='*'. Narrow that to user.*, or exclude com.apple.* explicitly, and it goes away for good.


Looking for more Mac-to-Linux troubleshooting? Read why COPYFILE_DISABLE does nothing on Linux, see what ._ files and __MACOSX actually are in a zip archive, browse every 1dot.ai guide, or check Quick X Folder Preview's product page.

Want to See Inside an Archive Before You Open It?

Quick X Folder Preview adds 13 Quick Look extensions to the space bar, notarized by Apple. Free for 14 days, then $4.99 once for a lifetime license.

Try It FreeRead More Guides