How To Keep 2 Folders In Sync Real-Time? I would like to keep Keybase data folders backup up to my local computer with some kind of real-time file sync solution.

Every time Keybase is opened, any local files sync to Keybase associated folder, and visa versa.

What's the current open source solutions that can achieve that?

Thanks
Hello and welcome to the site! 

Assuming you have folders "A" and "B" there are two ways of thinking about sync.

1) "One Way" sync will sync changes and deletions from folder A to folder B but will basically ignore changes in folder B (and will not sync them back to folder A).

2) "Two way" sync would be if you wanted to be able to modify either folders "A" or "B" and have those changes reflected in the other folder.

"One Way" sync can be accomplished with rsync (although you may want to install a newer version than the one that ships with macOS, as the default one is very old). I would recommend brew for this.

"Two Way" sync is trickier, and I'm not aware of any open-source tool that will let you create a two way sync of two folders on the same computer.

(That's another consideration: some tools will only work if folders "A" and "B" are on different computers. rsync can work with either one.)

One question to think about is what you are trying to accomplish by having such a mirrored copy. For example, if you accidentally delete a file in folder "A" and it immediately syncs to folder "B" and deletes the file there, have you really accomplished anything?

If what you are looking to accomplish it to be able to restore an accidentally deleted file, or revert to a previous version of a file that was changed in a way that you want to undo, that's a different scenario than just keeping two folders in sync.

I'm only vaguely familiar with Keybase, but another question I'd ask is whether such a mirror would be useful if there was some sort of corruption. It might be more useful to have a "snapshot" of all of the Keybase files at a particular point in time. Depending on how often its files change, you might be able to use launchd to create a tar.bz2 or tar.gz (or tar.xz if you also install xz with brew) "snapshot" of Keybase, and put a time-stamp in the filename, so if you did need to revert some changes, you would know that you had all of the files as they existed at a particular point-in-time.

Again, I'm not 100% sure that would work with Keybase, but I have used it with other apps.

Keyboard Maestro


  Every time Keybase is opened, any local files sync to Keybase associated folder, and visa versa.


If you want to trigger this every time the Keybase app launches and/or quits, then you should use Keyboard Maestro.

I'm not aware of any open-source option for that.