215

What are these __MACOSX folders I keep seeing in zip files made by people on OSX? Some take as much as 30% of the file.

What program are producing these __MACOSX folder and how can mac users avoid this mistake?

Yada
  • 2,391
  • 3
  • 16
  • 10
  • 17
    They are super-irritating, yes, and usually pointless as the resource forks are so often empty. But at least they're harmless, unlike the non-standard approach Apple have taken to >4GB archive sizes with the built-in OS X stuff, which will confuse any other tool and break again for sufficiently large files. And hey, it could be worse, it could be storing two copies of each file with the same name, one for the data and one for the resource fork, often making it impossible to access either, like pre-OSX Mac used to. Oh Apple, why do you hate standard file formats? – bobince Feb 03 '10 at 23:01
  • 3
    @bobince: actually, resource forks were a very good idea ... at the time. These days, the same effect is achieved by storing resources as individual files, most of which look pretty much like standard file formats. –  Feb 03 '10 at 23:20
  • 19
    Nothing wrong with metadata as such, it's just that Apple have such a knack of making up their own formats and messing up existing formats with gratuitously incompatible extensions! Having the content-type data as metadata is in itself a great thing and it saddens me that OS X is moving towards the Windows hack of file extensions as an alternative. Although this isn't as bad as on Linux, where the filesystem supports storing Content-Type metadata, but no desktops use it, preferring a thoroughly broken mixture of file-extension/name-patterns and content-sniffing (urgh!). Sigh, OSes eh? – bobince Feb 03 '10 at 23:33
  • @bobince: But yes, at least the format they made up for *this* does not do any real harm, other than slightly cluttering directory listings and wasting essentially 1 inode and 1 block per empty resource fork extracted, unless you use something like NTFS (which will store the file contents in the MFT for such small files), in which case it just wastes the "inode" (MFT entry). – SamB Feb 15 '11 at 20:52
  • 19
    Can be fixed after the fact by `zip -d filename.zip __MACOSX/\*` – Chris Johnson Dec 02 '12 at 01:31
  • Has anyone experienced an issue where when ziping and unziping a stale/empty version of file is used from __MACOSX. On a Windows machine the file is empty, on a Mac everything appears fine. If I didn't see it with my own eyes I would not believe it. – Daniel Sokolowski May 24 '18 at 16:02
  • @bobince Not entirely harmless. We've just encountered an issue, where Mac created zip files were triggering firewall rules, because of this folder. Re-zipping on windows fixes the issue. – user1751825 Aug 22 '19 at 04:35

4 Answers4

133

Here's a link that explains it pretty well. I suppose it is a bit late to help Yada, but for posterity.

Explanation of resource fork at Wikipedia

The rest is my opinion:

@nickf: Never seeing these files is not a FEATURE of those OS X versions it is a FLAW.

People produce data, wrap it up, store it on different mediums and so on. They need to know what is needed or what is not needed. Hiding it keeps them in the dark.

The age old bad idea of hiding things from users:

A programmer, concerned with expediency of accomplishing their own work, abuses something in the domain of the end user, to make it easy for themselves.

In this case they stored meta data in the user's data space, they then hid it from the user. They missed the big picture: The user won't become aware of the hidden details. When the user packages their data and ships it somewhere unanticipated by the programmer, missing parts won't get shipped or unknown parts will arrive which neither the user nor the recipient can explain.

Hiding things from the user is bad.

It assumes the user is stupid, when more accurately it is the programmer being stupid, or lazy.

To be clear, this bad habit is not confined to MAC. It is everywhere. It's a consequence of programmers falling in love with their own schemes and vendors prioritizing their own goals ahead of the needs of the end user.

In brief.

__MACOSX:
weird smelling programmer droppings emerging from under the rug where they were swept.

Programmers and vendors: Please keep things in the open. When you hide them, you make yourself stupid and the user uninformed.

pbernatchez
  • 1,759
  • 2
  • 11
  • 6
  • 31
    This answer would be better if it was just an answer. The extended ranting about stupid programmers and lazy users detracts from it. – Kristopher Johnson Jun 19 '15 at 13:15
  • 2
    @pbernatchez Actually, if you stopped to learn about how things looked like and how they evolved, probably you wouldn't leave here your own ranty, arrogant "droppings". Resource forks were a (really nice!) implementation detail pre-Mac OS X and users only found them when interfacing with other systems; since the 90s, Apple has increasingly moved to a world without resource forks, but still bending backwards to keep compatibility. "Store metadata in the user's data space"? WTF? How twistedly do you have to define "metadata" and "user's data space" to say that? You must hate filesystems! – hmijail Jan 20 '17 at 12:28
  • 4
    "Hiding things from the user is bad". Man, you must also hate all kind of user interfaces, and libraries, and abstraction, and... well, any kind of programming and computers more advanced than an abacus. – hmijail Jan 20 '17 at 12:39
  • 10
    This does not answer the question. After reading this answer I still have no idea what metadata is contained in the _MACOSX folder, or what resource forks are. I guess people are upvoting this just because they agree with the rant? – Atte Juvonen Feb 15 '17 at 13:25
  • 1
    Here's another link that I think explains resource forks pretty well: http://xahlee.info/UnixResource_dir/macosx.html – GDP2 Mar 29 '17 at 19:18
  • 3
    While I agree that the emotionally-charged tone is not helpful, I also absolutely agree that creating hidden things that are occasionally needed is a really bad idea, precisely as stated in this answer: users will either (a) not ship hidden files that are needed, or (b) ship hidden files that the recipient can see and neither understand. These files should either be visible, or the data should be embedded in the files in some manner that is flagged as "skippable" by other OS's. Hidden files and directories should be used primarily to **protect** users, not keep them in the dark. – Mike Williamson Oct 25 '18 at 01:47
  • 1
    Much better than the accepted answer – hmedia1 Feb 13 '19 at 06:43
  • 1
    If the wikipedia article explains it well, please quote the most relevant parts in your answer. – Michel Jul 04 '19 at 11:07
  • BTW, Windows does exactly the same invisible things, just in different ways. Try copying a video to a USB card on Windows, then investigate 'alternate data streams' & how to avoid them. – Tetsujin Nov 02 '21 at 12:10
  • @KristopherJohnson That may be, but "weird-smelling programmer droppings emerging from under the rug where they were swept" is a metaphorical gift that remains evergreen. I might also add that it gives me a rationale for deleting said folder, which is what I was looking for. – BobRodes Jul 14 '23 at 19:59
68

Apple provides built-in capability to ZIP files in OS X 10.3 and higher, and these files are the result of Apple storing Resource Forks safe manner. You would never see these files running OS X 10.3 or higher, but since Windows and other operating systems do not understand this special form of Resource Forks they will appear as you see them.

sgX
  • 103
  • 4
nickf
  • 2,254
  • 4
  • 26
  • 28
  • 4
    It's not just resource forks, anything beyond basic file contents gets put in the AppleDouble file. Apple's moving away from resource forks, but toward things like extended attributes that'll also get stored in the AppleDouble container. – Gordon Davisson Feb 05 '10 at 02:02
  • 25
    You make it sound like a feature. .zip files are intentionally lacking in the metadata department. If you want metadata, use a different format, not a Mac. Example of proper zip + metadata implementation: .jar – Zenexer Aug 22 '13 at 04:11
  • 17
    dead link, please fix. – Lucas Feb 02 '14 at 03:24
  • 94
    "since Windows and other operating systems do not understand"--Ugh. I just hate this kind of terminology – Joe Plante Apr 23 '14 at 02:38
  • 8
    Just discovered: if you're on a Mac, using the command line, `unzip filename.zip` will unpack the __MACOSX/ directory, which you don't want, but `open filename.zip` will do the right thing. – Edward Falk Jun 22 '16 at 18:40
  • 11
    Empty, meaningless explanation. Just like everything apple. Wtf is a resource fork? oh it's garbage. gotcha! – Ярослав Рахматуллин Aug 18 '18 at 11:24
  • 3
    This is a lazy answer that relies solely on the link, which doesn't work anymore. – hmedia1 Feb 13 '19 at 06:42
  • OK, but can I delete this folder? – ruslaniv Sep 28 '21 at 05:36
  • @ruslaniv See [here](https://superuser.com/a/1679494/1023031). – Wenfang Du Oct 02 '21 at 23:51
  • You can hate on this answer as much as you like. Sure, people sending zip files to windows users ought to be aware of this [& the answer doesn't tell them *how* so I don't know why it's so upvoted], but for Mac users, the system invisibly recombines these at unzip, meaning nothing is lost. – Tetsujin Nov 02 '21 at 12:09
21

To answer your final question:

how can mac users avoid this mistake?

macOS users can install a 3rd-party archiving utility like Keka, then tell it to not use Resource Forks, then set it as the default compressor.


How to do this with Keka

Tell Keka to not use Resource Forks

  1. Open Keka without a file (From Launchpad, Spotlight, etc.)
  2. Press ⌘ Cmd+, to open Preferences
  3. Select the Compression tab
    Keka "Compression" tab, selected
  4. Check "Exclude Mac resource forks (eg: .DS_Store)"
    A checkbox reading "Exclude Mac resource forks (ex: .DS_Store)"

Make Keka the default compressor

  1. In the same Keka Preferences window
  2. Select the General tab
    Keka "General" tab, selected
  3. Click "Set Keka as default compressor/uncompressor" [sic]
    enter image description here
AJM
  • 222
  • 1
  • 11
Ky -
  • 971
  • 4
  • 12
  • 29
  • 1
    This could be improved my adding some information on the last 2 steps, "tell it to not use Resource Forks, then set it as the default compressor." – Steven C. Howell Feb 16 '16 at 21:17
  • @stvn66 Done! Just FYI, though, that's usually outside the scope of these questions, which is why I didn't at first. – Ky - Feb 16 '16 at 21:52
  • 2
    Downvoting, sorry. I'm not a fan of installing 3rd-party software to fix a problem that can be fixed with the default software. As Chris Johnson pointed out above, `zip -d` will remove the resource forks from a zipfile. In fact, I think if you use zip in the first place, the resource forks don't get added in the first place. – Edward Falk Jun 22 '16 at 18:44
  • 2
    @EdwardFalk That's fair! This answer was meant to solve the "How do I get it to always behave this way?" problem, not the "How do I get it to behave this way once?" one. – Ky - Nov 09 '16 at 14:24
5

What is __MACOSX?

This is a question that comes up a lot, particularly from Windows users. So what the devil is the folder called __MACOSX and what can or should I do with it?

The technical term for what is contained within this curious folder is a resource fork.

__MACOSX, as you may have gathered, will only be created on a Mac. If you’re creating files on Windows, you won’t ever (unintentionally) create these or see them.

However, a common place windows users do see these is in ZIP files that they download or files that they share with Mac users.

Outside of a Mac, they are useless. Depending on who you ask, you may get told that they’re useless fluff wherever they are – a debate that I’m sure will continue to rage on. The point being they do actually have an intended purpose in the OS X operating system.

So, why do Mac Users keep sending them to me if they’re useless?

The answer to this one is that Mac users simply don’t see these folders. Take the ZIP file that you’re looking at and have a look on a Mac a hey presto, just like magic, they’re invisible. And they aren’t the usual type of hidden folder. They’re really hidden! Hence why Mac users won’t remove them from the archive before they distribute.

Can I Delete The __MACOSX folder?

On Windows, absolutely – it’s no good to you at all. Just useless tat taking space up. On Mac, you can’t see it anyway.

The main complaint is that these files can, on occasion, take up massive amounts of space. Usually, they are KB’s so apart from cluttering up your file system and MFT the space they take up isn’t usually of a concern.


Reference: What is __MACOSX?

Wenfang Du
  • 549
  • 6
  • 16