---
title: "How to Create a “Clean” Zip Utility in macOS Finder (No Junk Files)"
date: 2026-03-25
modified: 2026-03-30
author: "Miriam Schwab"
url: "https://miriamschwab.me/how-to-create-a-clean-zip-utility-in-macos-finder-no-junk-files/"
markdown_url: "https://miriamschwab.me/how-to-create-a-clean-zip-utility-in-macos-finder-no-junk-files.md"
type: post
excerpt: "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..."
categories:
  - "Work"
---
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](https://support.apple.com/en-il/guide/automator/welcome/mac)**! 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 &gt; Save** and name it **“Clean Zip”**.
2. Now, simply **right-click** any file or folder in Finder.
3. Navigate to **Quick Actions &gt; 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!
