Mac .DS_Store files FAQ: What are these .DS_Store files on my Mac, and how can I get rid of them?
Those crazy Mac .DS_Store files (also referred to as "dsstore" files) finally got to me, so I did some research on where they come from, and how to get rid of them (or more accurately, how you can't get rid of them).
Here's what I've learned about Mac OS X .DS_Store files.
Mac .DS_Store files - The short story
The short story is that Mac .DS_Store files are created by the Mac Finder. The "DS" in Mac .DS_Store files stands for "Desktop Services", and according to Adobe, Mac .DS_Store files "keep track of Mac folder view options, icon positions, and other visual information about folders."
Unfortunately the only way to avoid creating .DS_Store files on your local Mac filesystem is to quit using the Mac Finder.
That being said, if you're (a) trying to keep .DS_Store files off a Windows filesystem (or a networked filesystem), (b) trying to keep them off of a web server or out of zip archives, or (c) you want to find a way to delete them, read on.
How to remove Mac .DS_Store files
If you're really bothered by them, you can remove Mac .DS_Store files from the Unix command line (the Mac Terminal application). However, the Unix command required to delete these files is very dangerous, especially if you're new to Unix, so I won't repeat it here. If you want to try the command to delete Mac .DS_Store files, please check this Adobe web page.
Keeping Mac .DS_Store files out of Zip archives
If you want to keep Mac .DS_Store files out of zip archives, here are a few Mac Zip utilities which can help keep your zip files clean of these Mac dsstore files:
I'm sure there are other Mac zip utilities for this purpose. If you know of any free ones, just leave a note in the Comments section below, and I'll be glad to share it.
(Personally I work from the command line most of the time, and delete Mac .DS_Store files manually before creating my archives (zip archives or tar archives), but a friend of mine swears by YemuZip. I also like other Yellow Mug software products I have, so they're an easy recommendation.)
Keeping Mac .DS_Store files on Windows servers (filesystems)
Network administrators love it when you put crap on their network, right? Uh, wrong. Most network administrators I've met hate Macs, and one reason why is that the Mac .DS_Store files end up all over the place, including on Windows filesystems and other network filesystems.
Fortunately there is a way to keep Mac .DS_Store files off network shares. Apple has provide some documentation on this, but the short answer is this three-step process:
1) Open a Mac Terminal window.
2) Execute this command:
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
3) Log out as the current user, then log back in, or restart the Mac.
For more details, please see this Apple support page.
Mac .DS_Store files - Summary
I hope these Mac .DS_Store file tips have been helpful. If you have any tips on this topic you'd like to share, just leave a note in the Comments section below.