Compressing folders on a mac, without the .DS_Store

If you do not mind jumping down in to terminal, then this is pretty darn easy. If you are in /Users/username, which is your $HOME directory and there is a subdirectory named foo that you want to zip but ignore all .DS_Store files, then do the following:

zip -r foo.zip foo -x "*.DS_Store"

To interpret this, we are running the zip executable with the following parameters/arguments:

  • -r for recursively including all directories underneath the targets we want to zip.
  • foo.zip is the name of the zip archive we are creating
  • foo is the target directory we want to zip up
  • -x "*.DS_Store" excludes all files whose path ends in the string ".DS_Store"

No goofy third party applications needed nor do you need to trash your .DS_Store files at all - just rely on all of the unix tool goodness built right in to OSX / Darwin.


You can create an automator application that accepts a folder as input and produces a zip file of the folder contents without any cruft.

Store this application in /Users/you/Applications and then drag it into your finder toolbar. Then you can drag folders onto the app from any finder window.

Create an automator application

Add 'get selected finder items' step. And also add a 'run shell script' step with the 'Pass input' option set to 'as arguments'.

Add workflow steps

The script:

name=("$@")
cd "$name"
zipFileName=`basename "$name"`
zip "${zipFileName}.zip" -r ./* \
    -x */.DS_Store \
    -x */.git \
    -x */.svn \
    -x */.idea \
    -X */__MACOSX
mv "${zipFileName}.zip" ../

Accepts a folder as input and produces a zipfile with the name of the folder.


I don't think there's a way to do it by default, but there's two ways I can think of to achieve what you want.

First off, I found a free app called FolderWasher. Drop the folder on the app and it'll remove the .DS_Store files and zip it for you.

Alternatively (and potentially better than 3rd party software) you can use Automator to clean the archive after creation. There is actually already an action created for this. That's only one extra step, and you can drag the action to Finder so it's easy to find.