OS X

How To Sync Files and Folders on the Mac


To keep multiple folders and thousands of files synchronised can be a real headache without a convenient method to automate the task.

Consider this scenario: you have several folders on your Mac that must be kept fully synchronised with an external USB memory stick, hard drive, or simply with another computer or mobile phone. Copying files manually can be just too time consuming and it’s easy to miss a few files, so inevitably you end up with multiple versions in each location.

On the Mac, it’s easy to synchronise any numbers of files and folders; the most common methods are:

  1. With third-party apps from the App Store
  2. With the built-in rsync Terminal utility
  3. With rsync in combination with Automator
Each method is described in more detail below.



METHOD 1: Third-Party Apps

There are a dozen or so third-party apps available in Mac App Store that can simplify and automate the process of keeping files and folders synchronised. Additionally, cloud-based services such as Dropbox can synchronise files on multiple machines very simply (note that the Mac version of Dropbox is only available from their website, not in the App Store).

For most people a third-party app is the most convenient and hassle-free method to sync your data, with the advantage that lots of features are provided such as the ability to sync files, music, pictures, bookmarks and other data.

Some of the most popular synchronisation apps are:

Third Party Synchronisation Apps

METHOD 2: rsync Utility

Rsync is a very useful utility built into Mac OS X which allows the differences between two sets of files to be synchronised. Rsync can also sync data over a network, so if your folders are on another computer this method can be tweaked slightly to use the relevant remote hostname.

To use rsync follow the steps below.

1. Open Terminal from the Utilities folder or Spotlight

2. In the Terminal window type rsync -aE –delete ~/ <source folder> / “<destination folder>”

For example:

rsync -aE –delete “~/Documents/” “/Volumes/Macbook Pro Backup/”

This example keeps everything in the Home Folder’s Documents directory synchronised with the external disk named MacBook Pro Backup and deletes anything in the destination folder which isn’t already in the source folder. This example creates a copy of Documents in the top level of the external disk’s folder structure.

Note: rsync is a very powerful tool that has dozens of command-line options, so it’s worth reading the user manual in more depth (in Terminal, just type man rsync and press Enter).

METHOD 3: rsync Utility + Automator

While rsync certainly gets the job done, it’s much more useful when combined with Automator to simplify the whole process. This method is particularly effective when you have multiple folders in different locations that need to be synchronised, because you can enter any number of rsync commands into the script.

1. Open Automator from the Applications folder or within Spotlight

2. Choose Workflow when prompted, as below

Automator New Workflow
Create a new workflow in Automator

3. Search for the Run Shell Script action in the search field, then drag the icon into the main window on the right-hand side

Find Run Shell Script
Find the Run Shell Script command in the Actions list

4. In the Run Shell Script dialogue, change the Pass input drop-down field to as arguments

5. Under Options at the bottom of the workflow, make sure the checkbox labelled Ignore this action’s input is checked. The reason is that it’s just going to run as a standalone script and won’t take any files as input

6. In the Run Shell Script dialogue, delete any commands already included by default and replace them with the appropriate rsync commands. Make sure  you specify the correct source and destination folders

Run Shell Script window
Enter the appropriate rsync commands into the workflow

7. Choose Save from the File menu and save the workflow as an application, then hit the Save button

Save your Automator app
Save your workflow as an application

8. Now just run the application you’ve created whenever you want to synchronise the selected folders

Note that it’s possible to add your sync app to the Login Items (under System Preferences -> User & Groups) to run every time you login, or to create a scheduled task to run the script on a regular basis.

You might also like to copy the application into the startup items folder to run every time your computer starts. The startup folder on your Mac is at //Macintosh HD/Library/StartupItems but note that in the case of an external drive or USB stick it would need to be connected to run successfully.

Add rsync as a login item
Run your synchronisation app every time you login

Clean Your Mac Easily With CleanMyMac 3

There is no better tool for cleaning your hard drive from junk than CleanMyMac 3. While some speed issues on the Mac simply cannot be resolved but using an app, many that can are covered in this comprehensive cleaning utility.
But that's not all CleanMyMac 3 can be also clean up after uninstalling app and can remove temporary files, plugins, redundant files and offers better management of start up items and much more. It’s a utility that should have been built into macOS from the beginning.

Download CleanMyMac 3 for Free Now!

About the author

Roland Banks

I've been passionate about Apple ever since I bought my first iPod followed by a white polycarbonate MacBook in 2007. I currently own a MacBook Pro Retina, an iPad Mini Retina, and an iPhone 6.

6 Comments

Click here to post a comment

Leave a Reply

  • Just a quick note: Your formatter appears to have replaced the “–” switch prior to “delete” with a long dash “–”, making the command as typed not work as claimed.

  • It’s 2017 now and the Mac and Terminal have grown a little; when tested, Terminal didn’t like the quotation marks around the source and destination file paths. Removing them allowed it to run normally. Also, as mentioned by someone else, the example command given under option 2, using the rsync utility would be better off displayed using a “code” tag: “rsync -aE –delete “~/Documents/” “/Volumes/Macbook Pro Backup/”” before the “delete” argument that copied and displays as an en-dash and needless to say Terminal didn’t like that initially.

    Very helpful tip otherwise, thank you for making it so easy to follow and including the screenshots!

Related Posts