4

I have an iMac that is connected to my local network (and, subsequently, the Internet) that has a folder named DocShare.

I have a web server hosted off-site through a hosting company, with a similar folder called Online DocShare that hosts an online repository of files that would be related to the DocShare folder on my iMac. This server supports WebDAV, (S)FTP, SSH, etc. for file transfer.

I would love to find a way to have those two folders, one locally on my iMac and one on my server, synchronize so that anytime I upload a file to the local DocShare, it will appear on my Online DocShare, and vice-versa. It would be great if changes to files could be reflected, and if I deleted/modified/created a file on either side, it would reflect on the opposite folder.

So, it would be real-time syncing with a constant connection to the web server, or a scheduled sync process every time interval. So far, I have found a handful of programs for Windows, but none that do this for Mac.

If possible, I would love to see it in a GUI, with a possible command-line add-on (not necessarily command-line exclusively). Please let me know what possible options I have, or if I'm all washed up and there isn't anything that does this sort of thing.

4
  • Welcome to Ask Different! I've edited out some of the Ask Different Meta part of the post. Feel free to refine the question with the edit button if people aren't understanding exactly what you seek.
    – bmike
    Commented May 27, 2014 at 18:46
  • 1
    What about using dropbox. I'm assuming the server is *nix dropbox.com/install?os=lnx
    – dstarh
    Commented May 27, 2014 at 20:44
  • It is. That's interesting, I never thought about that.
    – Hunter E.
    Commented May 27, 2014 at 21:38
  • there are a few answers here: apple.stackexchange.com/questions/40483/…
    – dwightk
    Commented May 28, 2014 at 15:40

2 Answers 2

2

Unison is my go-to tool for a bi-directional file sync. (Mac binaries are available on a contributor's site.) I tend to think of it as a more interactive, configurable, and bi-directional version of rsync. Since it's a good *nix citizen, it can be automated via your favorite method. It's open-source and has ports to major OS platforms.

Unfortunately, Unison is no longer under active development, which may or may not be an issue for you. (I think the last time I used it was under 10.6.) But, it does fit your requirements nicely:

  • It handles bi-directional sync and works great on large files and data sets.
  • It can run in a completely automated way or interactively (where your review and confirm every change).
  • It runs over SSH.
  • GUI and CLI interfaces are available. (FWIW, the Mac GUI version, while nice/convenient, was always slightly flaky for me.)
  • Its end-user documentation is excellent and thorough.
  • It has configuration options for a multitude of use cases.
  • It has a design principle of leaving things in a Good State at all times, which makes it easier to recover should the connection be lost at any time.

And here's the main selling point for using it (for me, at least):

For remote SSH targets, it logs into the remote machine, runs a separate copy of Unison there to scan for changes, and then reconciles the state with your local machine to only transmit the bits (or bytes :-)) that differ, much like rsync does. This makes it very efficient with bandwidth, and it's also able to maintain caches of its file index on each side to make subsequent scans faster. For large data sets, this is a huge deal.

There are other Mac-specific tools for file synchronization, but, IIRC, they tend to assume that the filesystem is local, and are either very inefficient with bandwidth or very presumptuous about file "changes" (metadata, actual data) on large remote files / data sets.

Unison worked the way I needed it to, was reliable, and made me confident in using it due to its great documentation. Thank you, Benjamin C. Pierce!

4
  • Awesome! Sounds like the utility I'm looking for! Let me give it a go and see what it does. Thank you, excellent answer!
    – Hunter E.
    Commented May 27, 2014 at 21:42
  • Okay, I have an issue. My web server is hosted through JustHost, and while I can install Unison to my home directory on that shared server, I cannot modify the /usr/bin to make it work when the version of Unison on my machine attempts to connect via SSH. Changing my PATH variable doesn't seem to do much. Any suggestions?
    – Hunter E.
    Commented May 30, 2014 at 14:43
  • 1
    Yeah, on shared hosts you likely don't have permission modify anything outside of your home dir. That's okay. Just put unison wherever you like in your home dir (~/bin/) and set the servercmd config var to reference it. Also make sure that unison is executable and that it runs successfully via a normal SSH session.
    – wrksprfct
    Commented May 30, 2014 at 14:50
  • Also, it's sort of implied, but worth mentioning: You need the appropriate version of unison installed on the remote machine. In other words, you need the Linux version installed on the remote end. A uname -a will help you to figure out what version of Linux JustHost is using.
    – wrksprfct
    Commented May 30, 2014 at 14:56
1

Transmit provides an Automator action that synchronizes a local folder with a folder on your server. Combine that with folder actions and you should be set, unless I'm reading the question wrong. Transmit supports WebDAV and (S)FTP.

3
  • I "think" I've tried that (think being the key word). When I try the folder actions (when something is added to the mounted drive through Transmit, or something is added to the local folder, then copy to the opposite), it ends up being that the bi-directional sync I want turns into a continuous loop of copying files.
    – Hunter E.
    Commented May 27, 2014 at 19:45
  • Ah, the description read like it was bi-directional, but when I actually look at the action in Automator, I see that you pick a sync direction. Did you try different settings under the Compare or Skip Files dropdowns?
    – dwightk
    Commented May 27, 2014 at 19:55
  • Yeah, I tried that just a minute ago. Unfortunately, the primary issue stands: to do it bi-directionally, Transmit would have to run through two FULL syncs. It's a plausible option, but highly inefficient when my folder sizes grow.
    – Hunter E.
    Commented May 27, 2014 at 20:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .