MacOS – Using rsync to sync between 2 Macs wirelessly

data synchronizationmacosrsync

I have two Macs, I would like to use rsync to sync the home folder, preferences (if it's possible) and Applications.

I want rsync to run automatically if any file in these two Macs are changed, I want it to be synced completely and wirelessly.

Is it possible to make a .command file after writing the codes?

I would like to have a full tutorial on this, I've finding a lot of softwares online and also asking it everywhere. I can't get a cheap or free option to sync my 2 Macs easily. Thanks a lot!

Best Answer

Even though I can tell, that this is a bad idea, here is my answer :

If you have a router in between, that should work, if not, you need to setup an Ad-Hoc network.

Set-Up a ssh-keypair :

ssh-keygen -t rsa
ssh-copy-id 'user@otherMac'

And write your rsync for each mac :

rsync -e "ssh" -rc --delete ~/ user@otherMac

(-e "ssh" = use ssh for transfer
-r = recursive
-c = compressed
--delete = delete files that are not on the local device
~/ = Home-Folder
)

U can, of course, adjust those.

If you don't have static IPs on the Macs, I guess you can call them by their DNS-Name, like "Toms-MacBook.local" or you can ping the DNS-Name and output the IP and give it to the rsync command.

And the delete option is the problem. If two macs are working at the same time, files are deleted when you are working. In such cases you would use a server.

In the end, you have to try it out and decide for yourself, if there is nothing to lose, I would also give it a try.