Skip to content
Aback ZIP

Troubleshooting · 4 min read · Updated

How to remove __MACOSX and .DS_Store from a ZIP

Why ZIP files made on a Mac contain __MACOSX folders, ._ files and .DS_Store, how to remove them from an existing ZIP, and how to create clean ZIPs on macOS.

Open a ZIP made on a Mac on Windows or Linux and you will often find a __MACOSX folder, files named ._something and stray .DS_Store files. They are harmless, but they clutter the archive, can trip up upload systems that expect a specific folder layout, and look untidy when you send work to someone else.

What these files are

FileWhat it isSafe to remove?
__MACOSX/A folder Finder adds when you use Compress. It holds macOS-only metadata for the files in the archive.Yes, for almost every use.
._filenameAppleDouble files, usually inside __MACOSX, one per original file. They carry extended attributes such as Finder tags and download quarantine flags, and resource forks for old Mac files.Yes, unless the files are legacy Mac files that depend on resource forks, such as some old fonts.
.DS_StoreFinder's per-folder view settings: icon positions, view mode and sort order.Yes, always.
Icon\r, .Spotlight-V100, .Trashes, .fseventsdCustom folder icons and volume-level system folders, picked up when zipping a whole drive or a folder with a custom icon.Yes.

Why macOS adds them

macOS files can carry metadata that ordinary ZIP entries have no place for. When Finder's Compress command builds an archive, it saves that metadata separately as ._ files under __MACOSX/, so that another Mac extracting the archive with Archive Utility can put it back.

On a Mac you never see them: Archive Utility merges them back during extraction, and Finder hides files whose names start with a dot. Everywhere else, they show up as ordinary files and folders.

Remove them from an existing ZIP

  1. Open Clean ZIP and choose the archive.
  2. Keep the macOS option on; the Windows option for Thumbs.db and desktop.ini is on by default too. Turn on the others if you also want to drop .git folders, editor files or dependency folders such as node_modules.
  3. Check the preview of what will be removed. You can add your own patterns too, such as *.log.
  4. Clean and download. Every remaining file is copied byte-for-byte, so nothing else in the archive changes.

To remove individual files by hand instead, use ZIP Editor. On the command line, zip -d deletes matching entries in place, so work on a copy:

cp archive.zip clean.zip
zip -d clean.zip "__MACOSX/*" "*.DS_Store"

Create clean ZIPs on a Mac

The __MACOSX folder comes from Finder's Compress command; the Terminal's zip command does not create it. To leave out .DS_Store files as well:

zip -r -X archive.zip folder -x "*.DS_Store"

-r includes subfolders, -X leaves out extra file attributes, and -x excludes files matching the pattern. For TAR archives, macOS's tar adds ._ files itself unless you turn that off:

COPYFILE_DISABLE=1 tar -czf archive.tar.gz folder

Building the archive with Create ZIP in a browser also avoids __MACOSX and ._ files, because browsers do not expose that metadata. A .DS_Store inside a folder you add may still be included; Clean ZIP removes it afterwards.

Skip them when extracting

If you only need to unpack a Mac-made ZIP on Linux, leave the clutter out as you extract:

unzip archive.zip -x "__MACOSX/*" "*.DS_Store"

In Extract ZIP, simply leave those entries unticked.

Tools for this

Frequently asked questions

Not for Windows or Linux users, who never use it. On a Mac, files extracted without it lose things like Finder tags and the downloaded-from-the-internet flag. Only legacy files that depend on resource forks really need it.

More guides