A small macOS command line tool that finds Apple Photos screenshots older than 30, 60, or 90 days and optionally moves them to Recently Deleted.
The tool works locally against the Photos library visible on your Mac. If iCloud Photos is enabled, that includes iCloud Photos items synced to the local Photos library. Apple does not provide a public iCloud Photos server API for third-party deletion, so this project uses the native Photos framework and the user's explicit Photos permission.
- Finds screenshots using Apple Photos metadata instead of filename guessing.
- Supports fixed retention windows: 30, 60, or 90 days.
- Defaults to dry-run mode and prints exactly what would be deleted.
- Requires an explicit
--deleteflag before changing the library. - Prompts for
DELETEunless--yesis provided. - Moves assets to Recently Deleted, so they can still be recovered in Photos.
- Includes tests for retention and CLI parsing logic.
- macOS 14 or newer
- Xcode command line tools
- Photos permission for the built executable
- iCloud Photos enabled in Photos if you want synced iCloud items included
Clone the repository and build with Swift Package Manager:
swift build -c releaseRun the release binary:
.build/release/screenshot-sweeper --helpYou can also copy the binary somewhere on your PATH:
cp .build/release/screenshot-sweeper /usr/local/bin/screenshot-sweeperPreview screenshots older than 30 days:
screenshot-sweeper --retention 30Preview screenshots older than 60 days:
screenshot-sweeper --retention 60Move screenshots older than 90 days to Recently Deleted:
screenshot-sweeper --retention 90 --deleteSkip the confirmation prompt:
screenshot-sweeper --retention 30 --delete --yesLimit the number of matches processed:
screenshot-sweeper --retention 60 --limit 100This project is intentionally conservative:
- It never deletes by default.
- It only accepts 30, 60, or 90 day retention windows.
- It only targets assets that Photos marks as screenshots.
- It moves assets to Recently Deleted instead of permanently destroying them.
- It prints matching assets before deletion.
Always run a dry run first:
screenshot-sweeper --retention 90Then review the output before adding --delete.
The first run may trigger the macOS Photos privacy prompt. If access is denied:
- Open System Settings.
- Go to Privacy & Security.
- Open Photos.
- Enable access for the terminal app or signed binary you used to run the tool.
Limited Photos access can restrict what the tool sees. For full-library cleanup, grant full Photos access.
Run tests:
swift testRun from source:
swift run screenshot-sweeper --retention 30Build release:
swift build -c release- Homebrew formula.
- Optional JSON output for scripting.
- LaunchAgent example for scheduled dry runs.
- Signed and notarized release builds.
MIT