Skip to content

Terminal Automation

For more power, macOS lets you automate with shell scripts.

Scheduled Tasks with launchd

macOS uses launchd instead of cron (though cron works too).

Create a file at ~/Library/LaunchAgents/com.user.cleanup.plist:

xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.user.cleanup</string>
    <key>ProgramArguments</key>
    <array>
        <string>/bin/bash</string>
        <string>-c</string>
        <string>find ~/Downloads -mtime +30 -delete</string>
    </array>
    <key>StartCalendarInterval</key>
    <dict>
        <key>Hour</key>
        <integer>3</integer>
        <key>Minute</key>
        <integer>0</integer>
    </dict>
</dict>
</plist>

Load it: launchctl load ~/Library/LaunchAgents/com.user.cleanup.plist

This deletes Downloads files older than 30 days, every night at 3 AM.

Simple Bash Scripts

Create useful scripts in ~/.local/bin/:

bash
#!/bin/bash
# cleanup-downloads.sh -- Move old Downloads to Trash
find ~/Downloads -mtime +30 -exec mv {} ~/.Trash/ \;
echo "Cleaned up Downloads"

Make it executable: chmod +x cleanup-downloads.sh

Apple Intelligence Automation

macOS Tahoe includes Apple Intelligence features that automate common tasks:

FeatureWhat It Does
Writing ToolsRewrite, proofread, and summarize text in any text field
Smart RepliesSuggested email and message responses
Summary notificationsAI-generated summaries of notification stacks
Image PlaygroundGenerate images from text descriptions
Clean UpRemove unwanted objects from photos

Access Writing Tools by selecting text and right-clicking > Writing Tools.