If you read my post about keeping 2 Macs synchronized back in July, you may have left disappointed because I didn’t offer a solution that worked. Well, I can finally resolve that issue now.
It was a complete accident that I stumbled on Dropbox, but it’s finally the solution I was looking for. It will synchronize files between multiple computers, even those running different operating systems. All file system changes are monitored so that the instant a file is changed, it is synchronized with the other computers. Dropbox allows you to access your files through a web browser for those times when you’re on the go without the comfort of your own computer.
How I Use Dropbox
I use Dropbox to keep my iMac and MacBook Pro in sync. It’s great knowing that I can run out the door with my laptop and when I connect it to the internet, regardless of where I am, I’ll have all my files that I was working on available to me. It sounds too good to be true, and it almost is. There are a few limitations to keep in mind but I’ve found a way to work around them.
You’ll run into trouble if you try to open the same file on multiple computers–here’s a sample scenario. I use Things for task management. Things does not immediately write changes that you make to it’s database file, and once Things has been opened, the database is not read again. As such, if you open Things on both computers at the same time, you will loose any changes that you make to the database that was generated last.
I will only be using one computer at a time when working on any of my synced files, so this problem is easily solvable by closing all of my applications. This guarantees that when I switch computers everything is ready to go. To automate this process I wrote an applescript application.
This small application only closes programs that are visible and does so gracefully. That means that if you’re working on a Pages document, you will be asked if you would like to save or discard your changes rather than having an arbitrary decision made for you. Applications that run in the background like RescueTime will not be closed.
Download Close All Applications Script (source)
Syncing Specific Directories
A current limitation of Dropbox, but one that is being worked on, is that there is only one synced directory: your Dropbox. This is not great if you only want to synchronize a handful of directories and don’t feel like moving things around. Until folder watching is added you can get around this limitation by using symlinks. Let’s say that you want to sync your Documents folder. Here are the steps you would perform.
- Shut down dropbox on both computers
- Open Terminal
- Navigate to your Dropbox directory
- Run this command: ln -s /Users/<username>/Documents *replace <username> with your username
- Start Dropbox
To add other directories to your Dropbox simply repeat the process changing the command as necessary.
Dropbox does not handle extended attributes on the Mac but I have been told that it will be added soon. So for now if you really need extended attributes support hold off for a little bit. If you only need package support, then Dropbox is ready to go.
Jason, Dropbox doesn’t support selective sync yet. Click here to vote for this feature.
I have a computer that I do my development work on and would just like to sync my dev folder in my dropbox account with this machine as oppose to all the files/folders in my dropbox. Is this possible without having to create a second account and creating a shared folder?
Thanks! This was exactly the trick that I was looking for!
thanks for that great hint!
Thanks for this tip! It seems to be working perfectly on one computer, but whenever I try it on the second computer I just get
ln: ./Classes: File exists
I changed directories in terminal to the Dropbox folder as you instructed above, but still can’t get the changes in my ‘Classes’ folder to be reflected in the actual ‘Dropbox’ folder. Any suggestions?
Make sure that Dropbox is not running on both computers before you create the links. If you don’t you’ll run into a situation where Dropbox sees the new directory and creates it on the second computer. In that case the directory is physically located in the Dropbox folder on the second computer and not a link. So make sure that a Classes directory or link does not already exist on the second computer. When ln is used with only one argument, the link will be named the same as your target directory.
As to the actual syncing issue, try running the latest experimental build (0.6.455). Better symlink support on the Mac was added around 0.6.3xx.
OK; very interesting.
Was this thing we created a “hard” or a “soft” link?
And if I want to remove this would just throwing out the alias be OK, or would I need to delete it thru the terminal?
This is a soft link because we gave the “-s” option (stands for symbolic). If we had omitted that the command would have made a hard link.
Since the directory is simply a pointer to another directory in this case, it’s safe to remove. I don’t think there would be any problems by doing it through the finder vs. through terminal; it should just remove the link.
Hi again Jon…
Can you tell me how to remove the soft link via terminal? I want to have Dropbox disregard the folder I initially created, but I don’t think throwing out the alias (via the Finder) worked. Dropbox still seems to be syncing (and thus overwriting) with that folder.
Thanks in advance…
First you will need to shut down Dropbox on both computers. Next you should be able to remove the links with finder on both computers. Finally, start the Dropbox client again.
That should work, but you can remove the links via terminal like removing any normal file with the rm command. For example, rm /Users/jon/Dropbox/mylink
At the moment, Dropbox only synchronizes one directory. This is a problem if you want to synchronize data that’s all over the place (like Documents, Sites, Application preferences etc.). There are two approaches to working around the current limitation. First, you could move all data that you want synced to the Dropbox folder. This would require reconfiguring where your various software might look for data files on all synced computers. The second method (the one we’re doing here) sets up a soft link to the various directories that you want synced–in essence a pointer to the real data. This allows you to keep your data structured as you normally would. We’re not controlling Dropbox, just making it think that there’s data in the folder to sync.
Since the link is a pointer to another location, the link itself will not be synced. Dropbox will look at it and get redirected to wherever it is told to go. This can result in some odd behavior. For example, if you setup a link on one computer, but not on the second, then any data synced to the second computer would literally be placed in the Dropbox folder instead of a location that was pointed to on the first computer. If Folder-1 was a link to Folder-2, then Folder-1 points to the data in Folder-2 but it still looks like it’s Folder-1.
Edit: It’s kind of like setting up an Alias (Mac) or Shortcut (Windows), except the link type differs (there are hard links and soft links). Here’s some more reading: http://en.wikipedia.org/wiki/Symbolic_link and http://en.wikipedia.org/wiki/Hard_link
Hopefully that helps somewhat.
I don’t get how the terminal would control what Dropbox does, though.
I ran the command, and got this:
powerbook:~ Russell$ ln -s /Applications/QuarkXPress%206.5/Scripts/ln: ./: File exists
relaunched Dropbox, and nothing happened.
When you say “Navigate to your Dropbox directory,” is that something one should do through the Terminal?
What’d I miss?
(my d/b folder that I want to sync is: “/Applications/QuarkXPress 6.5/Scripts”)
Russel, you will need to change directories in terminal using the cd command. For example, I might do something like this:
ln -s /Applications/QuarkXPress\ 6.5/Scripts
Note the backslash to escape the space in “QuarkXPress 6.5.” Since I didn’t specify the target file, the link will be created in your present working directory, which in the case above should be the Dropbox folder.
How do I get username and password to log in Dropbox?
Can you please send me an invitation.
Invite sent 🙂