Automatically Select a Time Machine Drive

Time Machine is a really great feature in Apple OS/X that provides an easy way to insure that your files are automatically backed up. It even seamlessly supports multiple backup drives; you can disconnect one and connect another, and Time Machine will make use of the new drive, provided that you select it from the System Preferences for Time Machine.

If you do use multiple backup drives with Time Machine, you may have noticed that it’s a bit of a pain to drill down into System Preferences to enable a new drive every time you swap in a different backup drive. Fortunately Apple also provides AppleScript, which can be used to automate tasks like this.

I searched for a script that would automatically select whichever Time Machine drive I had just connected to my computer. pbeyersdorf over at Mac OS X Hints provided a script that purported to do this, but it was limited to two drives, and it didn’t work in OS/X 10.5.

I’ve modified that script to work in OS/X 10.5 and 10.6, and to support a list of backup drives. After you download the modified Select Time Machine script, just change the drivenames array to the names of your Time Machine drive volumes. Note that the script also requires that you have Growl installed in order to see error and informational messages. In addition, you must enable GUI Scripting, but my modified script will help you do that if necessary.

Leave a Reply