This guide shows you how to automatically delete archive files (like .zip, .tar, and .gz) immediately after you expand them on your Mac. This keeps your Downloads folder tidy and prevents duplicate copies of the same data from piling up. You’ll learn two methods: a built-in Terminal command that works with the default Archive Utility, and a free third-party app for a more visual, one-click approach.
What You’ll Need
- A Mac running macOS (any recent version, including Sonoma or Ventura).
- For Method 1: The built-in Terminal app (found in /Applications/Utilities/).
- For Method 2: The free app "The Unarchiver" (available on the Mac App Store or from its official website).
Step-by-Step
Choose one of the two methods below. Method 1 is more permanent and works for all archives opened with the default Archive Utility. Method 2 gives you a per-archive choice and is easier for beginners.
Method 1: Using Terminal (Permanent Setting)
- Open Terminal. Go to Finder > Applications > Utilities and double-click Terminal. You can also press Cmd + Space, type "Terminal", and press Return.
- Enter the defaults command. Copy and paste the following line into the Terminal window, then press Return:
defaults write com.apple.archiveutility dearchive-move-after-archive -bool true - Restart Archive Utility (or just test it). The setting takes effect immediately for new archives. To be safe, you can quit any open Archive Utility windows. You don’t need to restart your Mac.
- Test it. Double-click any .zip file in your Downloads folder. The folder will expand, and the original .zip file will automatically be moved to the Trash.
- To undo this later: Run the same command but change
truetofalse:defaults write com.apple.archiveutility dearchive-move-after-archive -bool false
Method 2: Using The Unarchiver (Per-Archive Choice)
- Download and install The Unarchiver. Get it from the Mac App Store (search for "The Unarchiver") or from the developer’s website. Open it after installing.
- Set it as the default for archives (optional but recommended). In The Unarchiver’s preferences (press Cmd + ,), go to the Archive Formats tab and make sure the formats you use (ZIP, RAR, 7z, etc.) are checked. Then, right-click (or Control-click) any archive file, go to Get Info, and under Open with, select The Unarchiver and click Change All.
- Open an archive with The Unarchiver. Double-click any .zip or .rar file. A small dialog box will appear.
- Check the "Delete archive after successful extraction" box. In that dialog, you’ll see a checkbox labeled something like "Delete archive after extraction" or "Move to Trash after extraction". Check that box.
- Click "Extract". The archive will be expanded into the same folder, and the original archive file will be deleted (moved to Trash) automatically.
- To make this the default behavior for all future extractions: In The Unarchiver’s preferences, go to the Extraction tab and check "Delete archive after successful extraction". This will pre-check the box in the dialog every time.
Common Mistakes
- Typos in the Terminal command. The
defaultscommand is case-sensitive. Make sure you copy it exactly, including the two hyphens beforebool. - Using the wrong app. If you have another archiver app (like Keka or StuffIt) set as your default, the Terminal command for Archive Utility won’t affect it. You’ll need to change the default app in Get Info or use that app’s own settings.
- Forgetting about the Trash. The archive is not permanently erased; it goes to the Trash. You still need to empty the Trash to free up disk space.
- Expecting it to work on files you drag to the Archive Utility icon. The Terminal setting applies to double-clicking archives. If you drag a file onto the Archive Utility icon in the Dock, it will still copy (not move) the archive.
Tips
- Test with a copy. Before relying on this, duplicate a small archive file and test the behavior with the copy. This way you can confirm the setting works as expected without risking an important file.
- Keep the Trash as a safety net. If you’re worried about losing data, don’t empty the Trash immediately after extracting. Wait a few days until you’re sure the extracted files are fine.
- Use Smart Folders to find archives. In Finder, create a Smart Folder (File > New Smart Folder) with the condition "File extension is zip" to see all your archives in one place and manually clean up any stragglers.
- For batch extraction with deletion, use the command line. If you have many archives to process, the
dittocommand in Terminal can extract and delete in one step:ditto -x -k archive.zip . && rm archive.zip(replacearchive.zipwith your file name).
Troubleshooting
- The archive is still there after expanding. First, check that you used the correct Terminal command (Method 1) or that the checkbox was ticked in The Unarchiver (Method 2). If you’re using Method 1, confirm that Archive Utility is actually the app handling the double-click. Right-click the archive, select Get Info, and see what’s listed under Open with. If it’s not Archive Utility, change it or use Method 2 instead.
- The Terminal command gives an error. Make sure you’re typing it in one line and pressing Return. If you see "could not find domain", you may have a typo. Copy the command from this page again.
- The archive is moved to Trash, but I want it back. Open the Trash, right-click the archive file, and select Put Back. It will return to its original location.
- The Unarchiver doesn’t show the delete checkbox. Make sure you have the latest version. Also, the checkbox only appears when you extract via the dialog. If you’ve enabled "Extract to subfolder" or other options, the dialog might look different. Check the Extraction tab in preferences to ensure the delete option is enabled there.
- I want to delete the archive only if extraction succeeds. Both methods do this by default. If extraction fails (e.g., the archive is corrupt), the original file is left untouched. This is the safe behavior you want.
Frequently Asked Questions
Will this work for .rar or .7z files?
Method 1 (Terminal) only affects the built-in Archive Utility, which handles .zip, .tar, .gz, and a few others. For .rar or .7z, you need Method 2 (The Unarchiver), which supports those formats and has its own delete option.
Does the archive go to the Trash or get permanently deleted?
It goes to the Trash. You can restore it from the Trash until you empty it. Neither method permanently erases the file.
Can I set this up so only certain folders get the auto-delete treatment?
No. Both methods are global settings. They apply to all archives you open with the respective app, regardless of folder. If you need per-folder behavior, you’d have to manually move archives to the Trash after extracting.
Will this slow down my Mac?
No. The setting simply adds a "move to Trash" step after extraction. The performance impact is negligible.
I use a different archiver app. Can I still auto-delete?
Yes. Most popular archiver apps (Keka, BetterZip, etc.) have a similar option in their preferences. Look for a setting like "Delete archive after extraction" or "Move to Trash after successful extraction" in the app’s settings.
What happens if the archive is password-protected?
The extraction will pause and ask for the password. Once you enter it and extraction succeeds, the archive will be moved to the Trash as normal. If you cancel the password prompt, the archive is left alone.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- How to Downgrade macOS Sonoma Without Data Loss
- How to Reduce Your Taxes: Legal Strategies56,500 $
- Tor Browser Privacy: Step-by-Step Setup
- Search Google from Spotlight on iPhone & iPad
- How to Stop Spider Webs on Windows
- Nginx Redirect Setup on a Linux VPS