back to writing
March 25, 2026

How to Create a “Clean” Zip Utility in macOS Finder (No Junk Files)

I was trying to compress a folder on my Mac and was annoyed that it kept including hidden metadata files like .DS_Store and __MACOSX folders in the zip. While these...

I was trying to compress a folder on my Mac and was annoyed that it kept including hidden metadata files like .DS_Store and __MACOSX folders in the zip. While these are harmless on a Mac, they appear as “junk” files to everyone else and are simply unnecessary.

I figured there must be a solution, so I went looking. I didn’t want to use the Terminal every time I needed to zip a folder, and I wasn’t interested in downloading a third-party utility for such a seemingly simple task.

After some experimentation with Gemini, I found a way to build a native “Clean Zip” tool directly into the macOS Finder using Automator! It’s a set-it-and-forget-it solution that works beautifully.

The Problem with Default Compression

The standard right-click “Compress” option in Finder is designed for Mac-to-Mac transfers. It preserves Mac-specific file attributes, which results in those extra hidden files. While you can technically use the zip command in the Terminal to exclude them, it’s a manual, repetitive process that breaks the flow of working in the Finder.

The Solution: A Custom Quick Action

By using macOS’s built-in Automator app, you can create a “Quick Action” that appears in your right-click menu. This allows you to perform a “clean” compression with a single click, using the power of a script without having to deal with a command line.

Step 1: Set up the Automator Workflow

  1. Open Automator (found in your Applications folder).
  2. Select New Document and choose Quick Action.
  3. At the top of the workflow, set the following:
    • Workflow receives current: files or folders
    • in: Finder
  4. In the search bar on the left, find “Run Shell Script” and drag it into the main window.
  5. Change the “Pass input” dropdown to as arguments.

Step 2: Add the Magic Script

Delete any text in the script box and paste the following:

for f in "$@"; do
    cd "$(dirname "$f")"
    zip -r "${f##*/}.zip" "${f##*/}" -x "*.DS_Store" -x "__MACOSX*"
done

This script tells macOS to:

  • Navigate to the folder containing your file.
  • Create a ZIP named after your file.
  • Crucially: Exclude any .DS_Store or __MACOSX files from the archive.

Tip: This script is designed to also handle multiple items at once. Whether you select one folder or highlight ten different files, the “Clean Zip” action will create individual, junk-free archives for every item in your selection.

Step 3: Save and Use

  1. Go to File > Save and name it “Clean Zip”.
  2. Now, simply right-click any file or folder in Finder.
  3. Navigate to Quick Actions > Clean Zip.

The Result

You now have a custom, native tool that creates clean archives ready for any operating system. No third-party apps, no Terminal windows, and no “junk” files stuffed in there. It’s a small workflow tweak that makes a huge difference in productivity, and makes me very happy!

filed under

Other posts

all posts
Elementor showed up for WordPress in 2025
Looking back at 2025, I’m proud of the way Elementor showed up in the WordPress ecosystem. Over the year, we were part of 40+ WordPress-related events, across 6 continents, over...
The Diff: AI in WordPress Week – April 27, 2026
Overview This was a week where MCP became something WordPress products are actually shipping. Two AI plugin versions landed in under two weeks, the MCP Adapter got a significant architectural...