Automatically deletes Apple Podcasts' StreamedMedia cache on a schedule, reclaiming disk space consumed by streamed (not downloaded) episodes.
Apple Podcasts accumulates streamed audio in a temp directory and never cleans it up. This agent wipes it every hour via a macOS LaunchAgent — no manual intervention needed.
Target directory:
~/Library/Containers/com.apple.podcasts/Data/tmp/StreamedMedia
git clone https://github.com/crgc/podsweep.git
cd podsweep
make installmake install generates the plist with your paths and loads the agent. It runs immediately on load, then every hour.
make unload
rm ~/Library/LaunchAgents/com.podsweep.podcasts-cleanup.plistCheck the agent is loaded:
make statusA line with com.podsweep.podcasts-cleanup means it's running. The first column is the last exit code (0 = success, - = not yet run).
Follow the log:
make logsRun once manually:
make run| Target | What it does |
|---|---|
make install |
Generates the plist with your paths and loads the agent (one-time setup) |
make reload |
Unloads + reloads — use after any changes |
make run |
Runs the script directly, outside of launchd |
make logs |
tail -f the log |
make status |
Shows the launchctl entry with exit code |
make lint |
Validates the plist XML |
Log file: ~/Library/Logs/podsweep.log
launchd agents run in a stripped environment with no TCC entitlements by default.
~/Library/Containers/ is sandboxed and requires Full Disk Access. Scripts invoked by launchd do not inherit it from your user session, so rm -rf will get Operation not permitted even though the same command works in Terminal.
Fix:
- Open System Settings → Privacy & Security → Full Disk Access
- Click + and add
/bin/zsh - Run
make reload
launchd's default environment does not include $HOME. The script in this repo reads it from the environment at launch time — if you modify the script, avoid assuming $HOME is set unless you've verified launchd passes it.
| Symptom | Check |
|---|---|
Agent not in make status output |
Re-run make install; verify the plist was written to ~/Library/LaunchAgents/ |
Non-zero exit code in make status |
Check ~/Library/Logs/podsweep.log for the error message |
| Plist rejected on load | Run make lint to validate the XML |
| Target dir not found | Normal — the script exits cleanly. The dir reappears when Podcasts next streams something. |
Operation not permitted in log |
/bin/zsh needs Full Disk Access. See Permissions. |
| Agent doesn't survive reboot | LaunchAgents load at login — verify the plist is in ~/Library/LaunchAgents/ |