Sweepfor Mac

Mac maintenance

Using the Mac Shortcuts App for Automated Cleanup

Build cleanup automations with the Mac Shortcuts app — clear caches, sort files, free disk space on a schedule. No coding required.

8 min read

The Shortcuts app on Mac is what Apple wants Automator to grow into. It’s drag-and-drop simple, syncs across iCloud to your iPhone and iPad, and runs every kind of system task — including a lot that’s relevant to keeping your Mac tidy.

This guide shows what’s actually possible for cleanup automation in Shortcuts, with concrete recipes you can build in 10 minutes.

What Shortcuts can and can’t do

Shortcuts can:

  • Move, copy, rename, delete files
  • Run shell scripts
  • Read folder contents and filter by date or size
  • Show notifications and dialogs
  • Get folder sizes (via shell)
  • Empty Trash
  • Run on a schedule (via Automation tab on iPhone/iPad, or Calendar triggers on Mac)
  • Be triggered by Folder Actions, hotkeys, menu bar, or Siri

It can’t (out of the box) directly clear macOS caches, force-quit apps, or modify system files. For those, it can run shell scripts that do the work.

The model is: Shortcuts is the orchestrator. Shell scripts do the dirty work. You glue them together.

Recipe 1: Empty the Downloads junk

A shortcut that finds files in Downloads older than 30 days, shows you what it’ll delete, and deletes them on confirmation.

Build it:

  1. Open Shortcuts, click + for new shortcut
  2. Name it “Clean Downloads”
  3. Add action Get Folder Contents → folder = ~/Downloads
  4. Add Filter Files → “Date Modified is more than 30 days ago”
  5. Add Get Details of Files → “Number of items”
  6. Add Show Alert with text “Delete X old files?” — set “Cancel” and “Continue” buttons
  7. Add Delete Files → input = filtered files

Run it manually for a while before automating. Once you trust it, add a schedule.

The “Show Alert” step matters. Skipping it and going straight to delete is how you accidentally lose something important.

Make cleanup automaticSweep does the routine cleanup so you can stay in your work. Get Sweep free →

Recipe 2: Free disk space on demand

A menu bar shortcut that runs the obvious cleanup steps in sequence and reports how much space it freed.

Steps in the shortcut:

  1. Get Disk Space action (or Run Shell Script with df -k / | tail -1 | awk '{print $4}' to get free KB)
  2. Store as variable before
  3. Run Shell Script to clear user caches:
    rm -rf ~/Library/Caches/*
    
  4. Run Shell Script to clear Trash:
    rm -rf ~/.Trash/*
    
  5. Run Shell Script for browser caches if you use Chrome:
    rm -rf ~/Library/Caches/Google/Chrome/Default/Cache/*
    
  6. Get Disk Space again, store as after
  7. Calculate after - before
  8. Show Notification with “Freed X GB”

Add this to the menu bar via Settings → Pin in Menu Bar. Now any time you need a quick cleanup, two clicks.

Be careful with what you delete in shell scripts. Test each command in Terminal first, with echo prepended, to see what it would target before running for real.

Recipe 3: Sort screenshots into folders

Screenshots pile up on the Desktop. This shortcut moves them to ~/Pictures/Screenshots/[year]/[month]/.

Steps:

  1. Get Folder Contents of Desktop
  2. Filter Files where Name contains “Screenshot” and File Extension is “png”
  3. Repeat with each
  4. Inside the loop:
    • Get Details of the file → Date Created
    • Format Date → year format yyyy, store as year
    • Format Date → month format MM, store as month
    • Run Shell Script to make the folder: mkdir -p ~/Pictures/Screenshots/$year/$month
    • Move File → destination computed from year and month

The path-building is a little awkward in Shortcuts because folder pickers expect static paths. Working around it with shell scripts or a “Move File” action that takes a Text input does the job.

Run this monthly (or after every screenshot binge) and the Desktop stays clean while screenshots remain searchable by date.

Tip: Most file-related actions in Shortcuts ask for permission the first time they touch a folder. macOS pops the access dialog. Approve it, and the shortcut runs without prompts after that.

Recipe 4: Quit memory-hog apps before sleep

A shortcut that quits Slack, Spotify, and Chrome on demand. Useful before closing the laptop lid for the weekend.

Steps:

  1. Quit App → Slack
  2. Quit App → Spotify
  3. Quit App → Google Chrome (with “Ask before quitting” off if you want it silent)
  4. Show Notification “Quit memory-hogs”

Add to menu bar. Click before bed. Mac wakes up Monday with 4GB more free RAM.

Recipe 5: Weekly cache cleaner

The bigger version of Recipe 2, run automatically every Sunday at 3am via Calendar trigger.

Build the shortcut, then create a Calendar event “Run Mac Cleanup” repeating weekly. In macOS, Shortcuts can be triggered from Calendar via the Automation tab on iPhone (since Mac doesn’t have a built-in Shortcuts automation tab yet — annoying but true).

Alternative: schedule a launchd plist that calls shortcuts run "Cleanup" on a cron-like schedule. Slightly more work but stays on the Mac.

The shortcut itself:

# Inside Run Shell Script
rm -rf ~/Library/Caches/*
rm -rf ~/Library/Logs/*
find ~/Downloads -mtime +90 -delete
find ~/.Trash -mindepth 1 -delete

Followed by a “Display Notification” with the freed space.

Recipe 6: Find big files and ask what to do

A shortcut that reports the 20 largest files in your home folder and lets you delete some.

Build it with Run Shell Script:

find ~ -type f -size +500M -not -path "*/Library/*" -not -path "*/.Trash/*" 2>/dev/null | xargs -I {} du -h "{}" 2>/dev/null | sort -rh | head -20

Display result in a dialog or save to a text file you can open. Doesn’t auto-delete — that’s intentional. Big files are project-specific and you should look at them before removing.

Connecting Shortcuts to Folder Actions

You can run a shortcut whenever a file is added to a folder. In Finder, right-click the folder → Quick Actions → Folder Actions Setup, choose “shortcut” as the action.

Combined with file-sorting shortcuts, Downloads can self-organize without any AppleScript. Drop a PDF in Downloads, the shortcut runs, the file moves to ~/Documents/PDFs/.

This is the cleanest way to build automation in macOS today — Shortcuts as the language, Folder Actions and Calendar as the triggers.

When Shortcuts isn’t the right tool

Shortcuts has limits. It struggles with:

  • Long-running operations (more than a few minutes)
  • Complex error handling
  • Deep system access (entitlements limit it)
  • Anything cache-related that requires deleting locked files
  • Reading files outside the folders you’ve granted access to

For those, native tools or proper cleanup software handle the job better. Shortcuts is for routine, predictable maintenance — not deep system surgery.

Skip the manual huntSweep finds every cache, log, and forgotten file in seconds. Download Sweep free →

Sharing shortcuts across devices

iCloud syncs shortcuts. Build one on Mac, it shows up on iPhone and iPad. Useful for things like “Free Mac space” — invoke it from your phone via Siri while on the couch.

To enable: Shortcuts → Settings → iCloud Drive must be on. Sync is usually fast (seconds) but occasionally sticks. Force a sync by toggling it off and back on.

Things to watch out for

A few traps:

  • File path expansion: ~ doesn’t always work. Use absolute paths or the Get File action.
  • Permissions: macOS asks once; if you say no, the shortcut silently fails forever. Reset in System Settings → Privacy & Security → Files and Folders.
  • Shell environment: shell scripts in Shortcuts run with a minimal environment. Set explicit PATH if calling non-built-in tools.
  • Quoting: paths with spaces break shell scripts unless properly quoted. Use "$1" not $1.

Worth building

The point of Shortcuts isn’t elaborate automation. It’s removing the 30-second tasks that pile up — the “delete old downloads,” “sort screenshots,” “run a quick cleanup” tasks. Built once, they keep working.

Start with one shortcut. Use it for a week. If it earns its keep, build the next one. Don’t try to automate everything in a weekend; you’ll end up with a complicated mess that nobody (including you) wants to maintain.

← Back to all guides