Skip to content

How To Use Rsync on the Mac – A Backup Solution Better Than Time Machine?

September 23, 2009

After getting my Mac set up properly, I was pretty concerned about getting my backups done. Backups are so crucial (Global Backup Survey), especially since everything’s stored electronically these days. Previously, I used to use FolderClone on Windows, but on the Mac, I wondered what options were available to me.

Time Machine was pretty popular, and came out of the box, but I didn’t like how there wasn’t any control with Time Machine. It was great for normal use, but I wanted to actually make a list of stuff that I wanted backed up, and Time Machine just didn’t have that functionality.

In addition, the space that Time Machine would use would be much greater than I would actually require. So I decided to look for some other backup solution, and I discovered that Macs actually came with rsync!

rsync mac best backup solution

Rsync is a great open-source application that uses delta comparison algorithms to compare files and perform a one-way file copy. You’ll need to actually write the script and run this script via Terminal, but it’s really easy. If you’re not interested in tinkering with command line stuff and scripting, you can actually use a free backup software for the Mac called iBackup, which runs on rsync, but gives you a pretty GUI to manage your backups – what to backup, where to backup, etc.

I highly recommend iBackup. In fact, depending on your needs, I would say that it’s better than cloning your hard drive, because it doesn’t copy over your OS-related files. Meaning you backup your data, and if anything happens, you can just load in a fresh copy of Mac OS, and then restore your data. However if you’re interested in rsync, or wondering how iBackup works, read on!

So rsync uses this format:

rsync -a –progress –delete

The -a flag stands for archive mode, which is just short for the -rlptgoD flag. This tells rsync to transfer only the files/folders that are different/have changed, and to do it recursively, while keeping permissions, ownerships, dates, etc intact.

The –progress flag shows you whatever progress rsync has made, and the –delete flag removes any extraneous files on the destination. This is important because I make loads of changes to my files, sometimes adding and removing files, and I want to be sure that they are removed and not kept on my backup drive.

One thing that stumped me when I ran my backup was that some folders didn’t appear in my backup drive, until I realised that I didn’t watch out for space characters in my filenames. So for instance, if you have any spaces in your filename, you’ll need to put the entire path in single quotes. Make sure you don’t put the ~ character in quotes as well! The ~ (tilde) character is just short for ‘/Users/Alvin/’ in my case. It’ll be your username on your Mac.

I keep all of this in a file named “backup”, and run it every couple of days. To run this, you need Terminal, which is located in Applications/Utilities. Also make sure that you make the “backup” file (you can actually give it any name) runnable by issuing the command:

chmod u+x backup

As an example, here is a portion of my backup script:

rsync -a –progress –delete ‘/Users/Alvin/Music/iTunes/iTunes Music/’ ‘/Volumes/ALVIN_POH/SyncBackup/Music/iTunes/iTunes Music’
rsync -a –progress –delete ‘/Users/Alvin/Pictures/iPhoto Library’ ‘/Volumes/ALVIN_POH/SyncBackup/Pictures/iPhoto Library’
rsync -a –progress –delete ‘/Users/Alvin/Library/Preferences/Yummy FTP/Bookmarks’ ‘/Volumes/ALVIN_POH/SyncBackup/Library/Preferences/Yummy FTP/Bookmarks’
rsync -a –progress –delete ~/Library/Mail/ /Volumes/ALVIN_POH/SyncBackup/Library/Mail

Once you’ve saved your backup script, run it with this command:

./backup

Easy peasy, painless, simple Mac backups!

Related Posts.