What Are the ._ Files and __MACOSX Folder in a Zip?
We built an actual AppleDouble file byte by byte to show what's inside one, then tested the real commands that stop them, not the ones most articles repeat.
By Ram Velmurugan · Founder & Lead Developer, 1dot.ai
._something is an AppleDouble sidecar, Apple's own format for storing a file's resource fork and Finder metadata separately, used whenever the destination can't hold that data natively. The __MACOSX folder in a zip is where a whole batch of them land at once: Apple's own ditto documentation says directly that its --sequesterRsrc flag, what Finder's Compress command uses internally, "preserve[s] resource forks and HFS meta-data in the subdirectory __MACOSX." It's safe to delete both. The fix is either to stop using Finder's Compress for files you'll send elsewhere, or to exclude the pattern with one Terminal command, covered below with the exact syntax we tested.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 does not create or clean zip archives and plays no role in anything tested below. Every command and script in this post was actually run, in a Linux container rather than on a Mac. zip, unzip, and Python behave identically across platforms for everything demonstrated here; where a behavior is specific to macOS (what Finder's Compress does, what ditto or dot_clean do), we cite Apple's own documentation rather than assume it from the Linux side. Sources checked live on November 23, 2026.
The Short Version
You unzip something, or a folder on an external drive, and find files you never created: a hidden ._report.docx next to every real file, or a whole __MACOSX folder you didn't put there. Neither is malware, a corrupted download, or a sign anything is wrong with your files. Both are Apple's own AppleDouble format, which has been part of Mac OS X since 10.3 Panther in 2003, over two decades of the exact same behavior. What changes year to year isn't the mechanism, it's how many people are still asking about it. Two different App Store apps built specifically to strip this junk from zip files both shipped in March 2026, which is its own kind of proof that the annoyance is still very real.
What a ._ File Actually Is
The zip format itself has no field for a Finder color tag, a resource fork, or an old Mac file/creator type code. Neither do FAT32, exFAT, most NFS mounts, or some SMB shares. So whenever macOS has to put a file somewhere that can't carry that metadata inline, it writes a second, hidden file next to the original, same name with ._ in front, holding exactly that leftover data. The format is called AppleDouble, and it isn't a vague internal convention. It's specified in RFC 1740, which documents Apple's own 1990 AppleSingle/AppleDouble Developer's Note: a fixed 4-byte magic number, a 4-byte version number, 16 filler bytes, a count of entries, and then one 12-byte descriptor per entry pointing at a chunk of data elsewhere in the file. Here are the entry types RFC 1740 defines that actually turn up in real-world ._ files:
| Entry ID | Name | What it holds |
|---|---|---|
1 | Data Fork | Not used in the sidecar file itself, since the original file already carries this |
2 | Resource Fork | Old-style Mac resource data: icons, layout info, sometimes small bits of code |
3 | Real Name | The file's original name, in case the filesystem had to shorten or alter it |
8 | File Dates Info | Creation, modification, backup, and access timestamps |
9 | Finder Info | Finder flags: color tag, position, the file/folder type and creator codes |
15 | Directory ID | Used for directories rather than individual files |
We Built One Byte by Byte
Most explanations of ._ files stop at "it's hidden metadata, ignore it." We wanted to see the actual bytes, so we wrote a small Python script that constructs a spec-correct AppleDouble file by hand, following RFC 1740's field sizes exactly, with a Finder Info entry and a Resource Fork entry, then parses its own output back apart to confirm the structure is really there:
MAGIC = 0x00051607 # AppleDouble magic number, RFC 1740 Appendix B
VERSION = 0x00020000 # version 2, RFC 1740 Appendix B
def build(entries):
header = struct.pack(">II16sH", MAGIC, VERSION, b"\x00" * 16, len(entries))
...
for entry_id, payload in entries:
descriptors += struct.pack(">III", entry_id, offset, len(payload))
data += payload
offset += len(payload)
return header + descriptors + dataRunning it (python3 -I appledouble_demo.py) on November 23, 2026 produced a real, valid 97-byte AppleDouble file and this parse of its own header:
Built a 97-byte AppleDouble file.
First 26 bytes (the fixed header), hex:
00 05 16 07 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02
magic = 0x00051607 (valid AppleDouble)
version = 0x00020000
entries = 2
entry 1: id=9 "Finder Info" offset=50 length=32 bytes=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
entry 2: id=2 "Resource Fork" offset=82 length=15 bytes=b'RSRC-DEMO-BYTES'That's the entire trick behind a real ._ file. The first four bytes always read 00 05 16 07, which is how every tool, including macOS itself, recognizes one on sight, no file extension needed. A real Finder Info entry is 32 bytes of mostly zeros with a few flag bits set, not the placeholder text we used above, but the container format is identical.
Why __MACOSX Shows Up When You Zip Something
Apple's ditto man page gives the command that creates a zip "similarly to the Finder's Compress functionality": ditto -c -k --sequesterRsrc --keepParent src_directory archive.zip. The ditto man page is explicit about what --sequesterRsrc does: "When creating a PKZip archive, preserve resource forks and HFS meta-data in the subdirectory __MACOSX." That's not an accident or a leftover bug. It's the documented, intentional behavior, and Finder's zip compression has separated metadata this way since OS X 10.3 Panther, in 2003.
We have no Mac in our test setup, so we rebuilt the structure a Mac produces by hand (a top-level __MACOSX folder mirroring the path of every compressed file, one ._ entry each) and zipped it with Info-ZIP's Zip 3.0 (July 5, 2008), the same release zip -v reports on macOS. Homebrew marks its own zip formula "keg-only" because macOS already provides zip. Before cleanup, listing it looked like this:
Archive: demo2.zip
Length Date Time Name
--------- ---------- ----- ----
0 2026-11-23 19:40 myproject/
0 2026-11-23 19:40 myproject/.DS_Store
19 2026-11-23 19:40 myproject/report.txt
0 2026-11-23 19:40 __MACOSX/
0 2026-11-23 19:40 __MACOSX/myproject/
45 2026-11-23 19:40 __MACOSX/myproject/._report.txt
--------- -------
64 6 filesSix entries in the zip for one real file. That ratio is why a folder of a few hundred files, compressed with Finder, can hand a Windows or Linux recipient what looks like twice as many items as you actually sent.
Where Else This Happens, Not Just Zips
Zips are the most visible case because the ._ files sit right next to the real ones in the same listing, but AppleDouble is older than the zip-specific behavior and shows up anywhere macOS can't rely on the destination filesystem to hold resource forks and extended attributes natively: FAT32 and exFAT USB drives, many NFS mounts, WebDAV shares, and some SMB configurations. If you've ever plugged a USB stick into a Windows PC after copying files to it from a Mac and found a pile of ._ files waiting, this is the same mechanism, just without a zip archive involved.
Is It Safe to Delete Them?
Yes, for the overwhelming majority of people reading this. The data inside a ._ file is Finder-specific: a color tag, a Finder comment, an old resource fork almost nothing outside a Mac ever reads. Deleting it doesn't touch the real file's content.
dot_clean instead of a blind delete. Apple's own tool merges a ._ file's AppleDouble data back into its matching real file's extended attributes, so a Finder tag or comment you actually cared about survives. Add -m to have it delete the ._ files as well. A plain find . -name "._*" -delete is faster, but it throws that metadata away without merging it.How to Stop or Remove Them
Don't use Finder's Compress for anything you'll send elsewhere
This is the simplest fix and the one most articles skip. The __MACOSX folder isn't an inherent property of the zip format. It's something Finder's Compress command and ditto's --sequesterRsrc flag deliberately add, documented in ditto's own man page. Zip a folder from Terminal instead, with zip -r archive.zip folder, and you've sidestepped the one mechanism that's actually responsible. We checked the Info-ZIP 3.0 binary itself: the string __MACOSX does not appear anywhere in it, so it has no code that could write that folder.
Free, zero commandsExclude it when you build the zip
Terminal zip still picks up .DS_Store files, and it picks up ._ files if the folder sits on an exFAT or FAT32 drive or a network share, where they exist as real files on disk. Exclude them at creation time: zip -r archive.zip myproject -x "*.DS_Store" "*/._*". We tested this (output further down): the archive held only the real files.
Many guides give -x "__MACOSX/*" "*/.DS_Store" for this step instead. In our test that version let a ._ file straight through, because a command-line zip never has a __MACOSX folder to exclude, and */.DS_Store misses a .DS_Store at the root of the archive, which is where it lands when you zip from inside the folder.
A word on zip -X specifically, since several guides recommend it for this exact problem: it doesn’t do what they say. Info-ZIP’s own help text defines it plainly, "-X eXclude eXtra file attributes," which is zip’s own per-entry extra-field data (timestamps, ownership, Unicode paths, and on some builds an old Mac-specific extra field), not the separate __MACOSX directory ditto creates. If you’re already avoiding Finder’s Compress, -X was never the thing protecting you.
Free, one commandClean a zip you already have
zip -d archive.zip "__MACOSX/*" "*.DS_Store" "*/._*" deletes matching entries from an existing archive in place. We built a zip containing a __MACOSX folder, two .DS_Store files and a stray ._ file and ran this exact command against it: all six junk entries were gone afterward, and the real file was untouched. No need to re-zip from the original folder.
Free, one command, no rebuildMerge or remove ._ files already sitting on a drive
This is for ._ files you find already extracted onto a FAT32 or exFAT USB drive, an SMB share, or a folder you already unzipped, not inside an archive. Apple ships dot_clean specifically for this: dot_clean /path/to/folder merges each ._ file's data back into its matching real file. Add -m to always delete the ._ files, or -n to delete only the orphans that have no matching real file. Either is safer than a blind find -delete, which discards the metadata without merging it first.
Free, Apple's own toolWhat the two exclude patterns actually did
We ran both versions on November 23, 2026 against a folder holding one real file, a .DS_Store and a ._ sidecar, the way it would look on an exFAT drive. The commonly quoted pattern, -x "__MACOSX/*" "*/.DS_Store", let the sidecar through:
$ zip -qr a.zip myproject -x "__MACOSX/*" "*/.DS_Store"
$ unzip -l a.zip
0 2026-11-23 21:39 myproject/
18 2026-11-23 21:39 myproject/report.txt
2 2026-11-23 21:39 myproject/._report.txtCleaning an existing Finder-style archive with the three-pattern zip -d command removed everything except the real file:
$ zip -d g.zip "__MACOSX/*" "*.DS_Store" "*/._*"
deleting: .DS_Store
deleting: myproject/.DS_Store
deleting: myproject/._report.txt
deleting: __MACOSX/
deleting: __MACOSX/myproject/
deleting: __MACOSX/myproject/._report.txt
$ unzip -l g.zip
0 2026-11-23 21:39 myproject/
18 2026-11-23 21:39 myproject/report.txtOne more correction worth stating plainly: setting COPYFILE_DISABLE=1 before a zip command is widely repeated advice online, and we could not confirm it does anything. Apple's own libarchive source checks that variable, which is why it reliably works for tar, bsdtar, and gnutar on macOS, confirmed by a CMake maintainer bug report describing exactly that behavior. Neither Info-ZIP's documentation nor Apple's ditto man page mentions that variable at all. If your actual tool is zip, use the -x exclude pattern above. If it's tar, COPYFILE_DISABLE=1 is the right, documented fix.
If You'd Rather Not Use Terminal
Two dedicated App Store apps exist purely to solve this, both released in the same month. We checked both live against Apple's iTunes lookup API on November 23, 2026:
| App | Price | Version | Released |
|---|---|---|---|
| CleanZip | $1.99 one time | 1.4 (Jun 24, 2026) | Mar 23, 2026 |
| ZipDiplomat | Free, Pro tier is a one-time unlock | 1.0.1 | Mar 11, 2026 |
CleanZip right-clicks an existing zip and rewrites a clean copy, and also catches non-Mac clutter like Thumbs.db and dev-specific junk like committed node_modules or .git folders. ZipDiplomat's free tier does the same cleanup on compression, with its paid tier adding custom ignore rules and archive splitting. If your actual need is "strip this one zip before I email it," and you'd rather not touch Terminal, either is a faster, cheaper path to the exact same result than anything 1dot.ai makes, and we think that's worth saying directly rather than steering you toward a bigger tool for a small job.
Does This Affect Our Own Apps?
Not directly, and we'd rather be specific than vague about it. Quick X Folder Preview lets you look inside a zip's contents on the space bar, without extracting it first, which means a __MACOSX folder would be visible to you in that preview before you ever open the archive, but the app doesn't strip it out for you. Files Magic AI's System Cleaner is built around a different kind of clutter entirely: unused apps, duplicate files, old installers, and developer caches like Xcode, Flutter, and Gradle build leftovers, not individual hidden files inside an archive someone sent you. If your actual problem is "clean this one zip," the Terminal commands above or one of the two apps in the previous section will solve it directly.
Sources & Further Reading
The AppleDouble format itself: RFC 1740, the IETF document implementing Apple's 1990 AppleSingle/AppleDouble Developer's Note, Appendices A and B.
Apple's own documentation of the __MACOSX mechanism: the ditto man page, specifically its --sequesterRsrc, --norsrc, and --keepParent flags, mirrored at ss64.com, and Apple's dot_clean man page, mirrored at keith.github.io/xcode-man-pages. Both re-read November 23, 2026.
COPYFILE_DISABLE and tar on macOS: CMake issue #16168 and Apple's libarchive copyfile patch. Zip's own version and flags, confirmed directly against the Zip 3.0 (July 5, 2008) binary, the same release Homebrew's formula page confirms macOS already ships.
App Store data for CleanZip and ZipDiplomat: Apple's iTunes lookup API, queried live on November 23, 2026 (itunes.apple.com/lookup?id=6760570084 and id=6759848121).
Background on the wider AppleSingle/AppleDouble history: Wikipedia, "AppleSingle and AppleDouble formats".
Our related coverage: previewing zip contents on Mac without extracting, and the live-data breakdown of Homebrew's cask-disabling policy, another Mac troubleshooting post built the same way, from a dataset we queried ourselves rather than a secondhand summary.
Frequently Asked Questions
The Bottom Line
A ._ file is a real, specified format, not an error, and __MACOSX is Apple's own documented way of carrying Finder metadata through a zip archive, working the same way it has since 2003. Both are safe to delete. The fix that actually addresses the cause, not using Finder's Compress command for anything you'll hand to someone else, is simpler than the Terminal incantations most guides lead with, and the ones that do involve Terminal are one line each, tested above with real output rather than assumed.
Looking for more Mac troubleshooting guides? See our guide to previewing zip contents before you extract anything, read about cleaning up a cluttered Downloads folder once you've extracted one too many zips, browse every 1dot.ai guide, or check Quick X Folder Preview's product page to see what else it previews on the space bar.
Want to See Inside a Zip 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