Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Schedule File Syncing on Mac: Step-by-Step

· 6 min read · Home Automation

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Automating file syncing on your Mac keeps folders in sync between drives, network volumes, or cloud folders without you having to remember to do it manually. This guide shows you how to set up scheduled syncs using the built-in tools on macOS — no extra software required. You'll need a Mac running macOS Catalina (10.15) or later, and two folders you want to keep in sync (for example, a local folder and an external drive, or a folder on your Desktop and a folder in iCloud Drive).

What You'll Need

  • A Mac with macOS Catalina (10.15) or later.
  • Two folders you want to sync (source and destination). They can be on the same disk, different disks, or a network volume.
  • Basic comfort with Terminal and the rsync command.
  • Optional: an external drive or network share if you're syncing to one.

Step-by-Step

  1. Decide what “sync” means to you. Do you want a one-way mirror (source overwrites destination) or a two-way merge? The built-in tools on macOS handle one-way sync best. For two-way sync, you'd need a third-party app. This guide covers one-way sync.
  2. Open Terminal. You'll find it in Applications → Utilities or by searching with Spotlight (Cmd+Space).
  3. Test your rsync command manually. The basic syntax is:
    rsync -av --delete /path/to/source/ /path/to/destination/
    Note the trailing slashes — they matter. The -a preserves permissions and timestamps, -v shows progress, and --delete removes files in the destination that no longer exist in the source. Run this once to confirm it works and syncs correctly.
  4. Create a shell script for the sync. Open TextEdit, create a new document, and paste your rsync command. Save it as a plain text file (Format → Make Plain Text) with a name like sync-folders.sh. Make sure the file has no extension like .txt — if it does, remove it.
  5. Make the script executable. In Terminal, navigate to where you saved the script (e.g., cd ~/Documents) and run:
    chmod +x sync-folders.sh
  6. Test the script. Run it by typing ./sync-folders.sh in Terminal. If it works, you have a working sync script.
  7. Open Automator. You'll find it in Applications. Choose “New Document” and select “Calendar Alarm” as the type. This creates an action that runs at scheduled times.
  8. Add a “Run Shell Script” action. In the Automator window, search for “Run Shell Script” in the library on the left, and drag it to the workflow area on the right. Change the “Shell” dropdown to “/bin/bash” and paste the full path to your script, like:
    /Users/yourusername/Documents/sync-folders.sh
    Make sure the “Pass input” option is set to “to stdin” (default).
  9. Save the Automator workflow. Go to File → Save, and give it a name like “Sync Folders”. Automator will ask you to schedule it — set the frequency and time. For example, you can run it daily at 2:00 AM.
  10. Test the scheduled run. After saving, the Calendar app will open with a new event. You can run the workflow immediately by clicking the “Run” button in the event, or wait for the scheduled time. Check your destination folder to confirm files appear.
  11. Verify the sync works automatically. Add a test file to your source folder, wait for the scheduled time (or trigger the event manually), and check the destination. If it appears, you're done.

Common Mistakes

  • Forgetting the trailing slash. In rsync, /source copies the folder itself, while /source/ copies its contents. This is the #1 cause of unexpected folder nesting.
  • Using the wrong path. Spaces in folder names must be escaped or quoted. For example, use "/Users/me/My Folder/" or escape spaces with backslashes.
  • Not making the script executable. If you get “Permission denied,” you skipped the chmod +x step.
  • Running the script with the wrong shell. Automator's default shell is /bin/sh, but if your script uses bash-specific features, you need to set it to /bin/bash.
  • Syncing to a network volume that isn't mounted. If the destination is on a network drive, it must be connected when the script runs. Otherwise, rsync will fail.

Tips

  • Add a log to your script. Redirect output to a log file to see what happened: rsync -av --delete /source/ /dest/ >> ~/sync-log.txt 2>&1
  • Use a lock file to prevent overlapping runs. If your sync takes longer than the interval, you might get two instances running. A simple lock file can prevent that.
  • Test with a dry run. Add -n to your rsync command to preview what would happen without actually copying. This is great for verifying paths.
  • Consider using launchd for more control. If Automator feels limited, you can create a LaunchAgent plist file to run your script at specific intervals. This gives you more scheduling flexibility (e.g., every 30 minutes).
  • Back up your script. Keep a copy of your .sh file in a safe place, like a cloud folder, so you can recreate the setup if needed.

Troubleshooting

  • Nothing happens at the scheduled time. Check if the Automator event exists in Calendar. If it doesn't, you may have saved without scheduling. Re-save the workflow and choose a time. Also, ensure your Mac is awake at that time — if it's asleep, the sync won't run. You can set a “wake” schedule in System Settings → Energy.
  • “Permission denied” when running the script. Run chmod +x /path/to/script.sh again. Also, check that the script file isn't quarantined by macOS (right-click → Open to bypass).
  • rsync: command not found. This is rare, but if it happens, use the full path: /usr/bin/rsync.
  • The sync runs but files don't appear. Check the log file (if you set one) for errors. Common issues: wrong paths, permissions on the destination, or the destination is on a filesystem that doesn't support certain attributes. Try simplifying the rsync flags to -av without --delete first.
  • Automator workflow runs but does nothing. Open the workflow in Automator and click “Run” to see the output. Often the issue is a typo in the script path.
  • Syncing to iCloud Drive is slow or fails. iCloud Drive may not be fully downloaded locally. Ensure the folder is downloaded (right-click → “Download Now”). For large folders, consider syncing to a local folder instead.

Frequently Asked Questions

Can I sync two folders on the same Mac?

Yes, absolutely. Just use the full paths to both folders in your rsync command. For example, /Users/me/Documents/Work/ and /Users/me/Desktop/Backup/.

Is there a built-in Mac app for syncing?

macOS doesn't have a dedicated “sync” app, but it includes rsync (a powerful command-line tool) and Automator, which together can create scheduled syncs. For a more user-friendly interface, you'd need third-party software.

Can I sync in real-time, not on a schedule?

Yes, but not with the built-in tools alone. Real-time sync requires a tool that watches for file changes, like fswatch (available via Homebrew) or a third-party app. The schedule method in this guide runs at set times, not continuously.

Will this work with an external hard drive?

Yes, as long as the drive is connected when the sync runs. If the drive is not mounted, rsync will fail. You can add a check in your script to mount the drive first, or simply ensure the drive is plugged in.

What if I want two-way sync?

rsync is one-way only. For two-way sync (changes on either side merge), you'd need a third-party tool like Syncthing, FreeFileSync, or a cloud service that supports two-way sync. The method here is for one-way mirroring.

Can I pause or stop a scheduled sync?

Yes. Open the Calendar event for the sync and delete it, or simply uncheck “All-day” and remove the time. You can also disable the Automator workflow in Calendar by editing the event and changing the time to a future date.