Add Automatic Cloud Syncing To Any Mac App [How-To]

By

Syncing any file or directory to Dropbox is easy using Terminal.
Syncing any file or directory to Dropbox is easy using Terminal.

One of the greatest things about a service like Dropbox is that as long as you are either using apps with support baked in or can save your files to a Dropbox folder, you can keep all your data synced between multiple Macs.

What if you want to keep app data synced between Macs that don’t lend themselves to being saved to a Dropbox folder or don’t come with Dropbox support, though?

For example, most Mac games don’t allow you to specify where you keep your saves, but what if you want to be able to save your game on your iMac and then load it up again on the road on your MacBook Pro? Or what if you want to keep your app settings synced between your iMac and MacBook Air? Settings files are usually stored in a hidden system folder on your Mac, so how do you keep things synced then?

It’s actually way easier than you might think. Here’s how to keep any file or folder synced between Macs using the cloud, no matter where it’s stored.

The technique we’re using in this tutorial involves symbolic links. Symbolic links are old as the hills: they’ve been around since the 70s, and OS X has always had them, ever since the first release.

What symbolic links allow you to do is tell your Mac that a file or folder in one directory should be treated as if it were in another directory. For example, using symbolic links, you can tell your Mac that any time you write a file onto the Desktop, it should really be saved to your Documents folder instead.

What we will do in this tutorial is “trick” your main Mac into writing all of its changes to a given file or directory to your Dropbox folder instead. Then we will similarly “trick” your other Mac into accessing the synced data from your Dropbox folder instead of from its normal location.

Warning: Only try to sync files or folders that you will be using on one machine at a time! Doing otherwise could wreak havok. Also, this trick works best on smaller files and folders of less than a megabyte.

1. If you don’t already have one, register for a free Dropbox account, then download and install the free app on any Mac you want to keep in sync. A new folder called Dropbox will be created under your Users / [Your User Name] / directory. Any files or folders saved here will automatically be synced between any other Mac with Dropbox installed.

2. Find the file or folder you want to keep synced in Finder. Depending on the app you’re trying to keep synced, this could be tricky, but Google will usually tell you where your favorite app’s settings or save files are stored.

3. On one Mac, open Applications > Utilities > Terminal.

4. At the prompt in your main Terminal window, type “ln -s” without the quotes, then hit space. Don’t hit Enter!

5. Now drag the file or folder you identified in step two to your Terminal window. A path to that file or folder should automatically be appended to the end of the prompt. Again, don’t hit Enter!

6. Now find your Dropbox folder in Finder and similarly drag that folder on top of your Terminal window. Again, a path to your Dropbox directory should get appended to the end of the string.

7. You should have something that looks like this: ln -s /path/to/desired-file-or-folder ~/Dropbox/desired-file-or-folder. It’s okay, you can hit Enter now.

8. It won’t look like anything has happened, but if you go look in your Dropbox folder, you’ll now see a copy of the file or folder you want synced. Better yet, if you change the file or folder in its original location, the one in your Dropbox folder will also change. Why? Because it’s really the same file!

9. So far, so good. We’ve synced a file or folder in one location on your Mac to your Dropbox folder automatically. Now we need to tell all your other Macs to start looking for this same data in your Dropbox folder for now on.

10. On any other Mac you want to keep synced, find the same file or folder you identified in step 2 in a Finder window.

11. Back this data up somewhere else on your Mac in case something goes wrong, then — and this is scary! — Delete them from their original location.

12. Here’s where it gets cool. Open a new Finder window and go to your Dropbox folder. You should see the data you synced on your other Mac in step 8 already there.

13. Open Applications > Utilities > Terminal.

14. Type in “ln -s” at the prompt with a space at the end. Don’t hit Enter.

15. Drag the file or directory from your Dropbox folder onto the Terminal window. Again, don’t hit Enter.

16. Now drag the parent directory of the data you deleted in step 11 to the Terminal window.

17. You should now have something like: ln -s ~/Dropbox/desired-file-or-folder /path/to/parent-folder. Enter.

18. Repeat steps 10 – 17 for any additional Macs you want to keep in sync. Voila! You’ve now synced your data between Macs!

What did we accomplish here? Using the above steps, I added Dropbox support to the Mac rogue-like Dungeon Crawl: Stone Soup which automatically saves the game between turns: I can now start a game on my iMac and then continue it on my MacBook Air, all without ever playing a section of the game over. However, you could use this same technique to make sure that all your PhotoShop settings are the same between Macs, no matter which machine you change them on, or to create directories that sync with Dropbox even if they are located outside of your Mac’s Dropbox folder. Using this technique, as long as you know where your Mac app saves its data, you can automatically keep the data synced to the cloud. It’s all up to you!

Hope this was helpful. Let us know how you got on in the comments!

Newsletters

Daily round-ups or a weekly refresher, straight from Cult of Mac to your inbox.

  • The Weekender

    The week's best Apple news, reviews and how-tos from Cult of Mac, every Saturday morning. Our readers say: "Thank you guys for always posting cool stuff" -- Vaughn Nevins. "Very informative" -- Kenly Xavier.