본문 바로가기

Tips/Mac

How to sync your Mac's Documents, Desktop, and any other folder to Dropbox

How to sync your Mac's Documents, Desktop, and any other folder to Dropbox

We're in the early days of the cloud, but it's easier than you might think to put all your important files onto Dropbox.

There are plenty of reasons to put things into the cloud, be it as a backup or to access them remotely from other devices. But putting things into the cloud can be a hassle — Apple's trying to make it a little more seamless with iCloud but if you're old school like me, that seamlessness just doesn't do it for you. There's something about having all my computer's files neatly organized and accessible that soothes my more obsessive tendencies.

At the same time, I want to be able to access my important files while I'm on the go, and I want to know that they're backed up in case catastrophe strikes. That's where the cloud really comes in. I've got a local Time Machine backup running (two, actually) and I use Backblaze for nightly backups to the cloud, and though I can use Backblaze to access files from my iPhone, it's just terribly slow.

Enter Dropbox

Dropbox, on the other hand, is blazing fast. Uploads and downloads sling through the web as fast as my connection can handle. I can open the Dropbox app on my iPhone or iPad and get to all the files in there with ease and speed. But there were two basic options for backing up my files to Dropbox: either copy them over regularly, or just move them onto Dropbox (oh, the humanity).

Turns out, there's another way, one in which you can keep your folders and files right where they are and have them backed up and synced with Dropbox. It all works through the magic of symbolic links.

How does this work?

You might be familiar with alias links on your Mac — it creates a shortcut that points to another file, open the shortcut and it opens that file. A symbolic link is similar, except that instead of creating a pointer it creates a redirect. Whatever you do with the symbolic link (or symlink) is applied to the linked file.

Dropbox works by creating a folder on your computer that is synced with their servers. Place a file in that folder and it's synced to the cloud. Upload a file from a Dropbox app or their web interface and it'll be downloaded onto your computer. Basically, that's it. Thing is, if you want to back up files to Dropbox, copying them into that folder means they're taking up space twice on your hard drive, and just moving them to Dropbox takes them right out of your organizational flow.

Put a tiny symlink into Dropbox and it can back up an entire folder elsewhere on your computer

If you were to create an alias to a file and put that in the Dropbox folder, only the alias would get backed up, and that's not terribly useful. But if you put a symlink into the Dropbox folder, when the Dropbox backup app looks at it it's redirected to the linked file, and it backs that up instead. So with one 25-byte symlink you can back up gigabytes upon gigabytes of data without duplicating it on your computer.

The additional benefit is that you can sync and back up entire directories that would be otherwise difficult to move. You can put your Pictures folder into Dropbox with a symlink or your entire Documents folder. Heck, you could even sync and back up your Mac's desktop files and installed apps.

This sounds too good to be true…

There are some caveats to note here. The first is cost: Dropbox does offer a free tier, and it's a paltry 2GB. That might be enough for you, but chances are if you're planning on putting an entire folder like Documents in there you'll need more space. Thankfully, Dropbox isn't terribly expensive, offering 1TB of storage for $9.99/month. Chances are you'd be able to back up your entire computer onto that if you really wanted to.

There are risks that come with putting your files into the cloud, of course, and they come down to you to manage them. Make sure you have a strong and unique Dropbox password and use pin or Touch ID security in the mobile apps when available.

If you change a file on your phone or with Dropbox on the web, that file will be synced down to your computer, and vice versa.

The biggest risk you run, however, is inherent to Dropbox itself: any changes made to a file in Dropbox are synced to all devices linked to that account. So if you change a file from your phone, that file is saved on the server and synced down to your computer with those changes. If you delete a file from the web interface, it's deleted from your computer. And vice versa. Dropbox does offer paying customers 30 days of stored historical versions and backups of deleted files, but it's still worth noting the risks of what you're wading into here.

Those risks are minor, though. Set and practice good security and be conscious of what you're doing with your files and you'll be in good shape — and your files will be there for you whenever and wherever you need them.

How to sync folders on your Mac to Dropbox

  1. Download and install the Dropbox app from the Dropbox website (download will start automatically).
  2. Once you've got the Dropbox app up and running, open Terminal.
  3. Navigate in Terminal to your Dropbox folder by typing cd /Users/YourMacUsernameHere/Dropbox and then hitting return. A new line in Terminal will appear that's Your-Computer-Name:Dropbox YourUserName$
  4. Create your symbolic link by typing ln -s ~/FolderNameHere

     and hitting return. A folder will appear in your Dropbox folder with the alias/shortcut arrow and it will immediately begin uploading.
    To create a symlink to your Desktop, type ln -s ~/Desktop

    • To create a symlink to your Documents folder, type ln -s ~/Documents
    • To create a symlink to any other folder or file, simply type its file path after ln -s ~/FilePathGoesHere — this is useful for if you want to back up most your Documents folder, but not necessarily everything in there (for instance, a 30GB Windows virtual machine from Parallels).
    • To create a symlink to a folder or file with a space in its name, put a backslash before the space, like so: ln -s ~/Documents/Star\ Trek\ Aldrin
  5. Dropbox will start uploading your symlinked folders.

Now what?

Now you go about using your Mac like you normally would. Any time you edit or create a file in one of your symlinked folders, it'll be automatically uploaded to Dropbox. Any time you remotely edit one of those files, it will be synced back down to your Mac. It's the magic of the cloud.

Advanced: Sync files with another Mac!

This isn't just a handy cloud back-up and storage tool — you can also use Dropbox to sync files between multiple Macs. Yeah, crazy, we know. Just imagine stepping away from your iMac and opening your MacBook at the coffee shop to have all of your important files, even your desktop, synced right over. Here's how to make that a reality:

  1. Get your folder(s) set up on your primary computer as instructed above.
  2. Install and set up Dropbox on your second computer. It will start to download the folder that you symlinked and uploaded from your primary computer.
  3.  both computers to finish syncing. See that little syncing icon on the Dropbox menu bar icon? That means that Dropbox is still syncing. You want just the open box Dropbox icon, no little sync icon. Seriously. Wait for the sync to finish.
  4. Once the folder is fully downloaded, quit Dropbox on the secondary computer. Seriously, quit Dropbox.

    1. Click on Dropbox in the menu bar.
    2. Click on the gear icon in the bottom right corner of the Dropbox menu.
    3. Click on Quit Dropbox.
  5. On the secondary computer, open the Dropbox folder.
  6. On the secondary computer,drag your synced folder out of the Dropbox folder and into the location where you want it to be. In the case of Documents or Desktop, you'll be replacing an existing folder in your user folder (get to that by opening Documents or Applications and hitting cmd + up arrow).
  7. On the secondary computer, open Terminal and navigate to your Dropbox folder by typing cd /Users/YourMacUsernameHere/Dropbox and then hitting return.
  8. On the secondary computer, create a symlink to the folder you dragged out of Dropbox by typing  ln -s ~/FolderNameHere and hitting return.
  9. Double check that both the primary and secondary computers have identically-named symlink files in the exact same Dropbox folder locations.
  10. Re-start Dropbox on the secondary computer (it's in Applications) and give it a moment to sync. If all has gone well, there won't be anything to sync since both folders are identical.

And that's it. Now when you change a file in your symlinked folder on one computer, it will be uploaded to Dropbox and immediately downloaded onto the other computer.