Is there a way to keep my RPi File System in sync with a directory on my Mac? Can I do this with rsync? (I write most code on the RPi, and would like a copy of it on my Mac, in case I corrupt the SD card)
2 Answers
The simple answer is No.
If you search you will find a couple of posts on this. I tried unsuccessfully for some time.
It is possible to rsync
your Home, but in general it will not work.
There are a couple of reasons for this;
rsync
differs quite significantly between Unix and Linux- The users differ between the systems, making permissions difficult.
- The most significant reason is the restrictions macOS imposes due to SIP. It simply refuses to allow access to certain directories e.g.
/
.
You may be able to rsync
certain directories on the Pi, provided they are normal user directories, with no special access restrictions.
I suggest you try other options; netatalk
on the Pi allows you to access from Finder
using afp://
. ftp
is also a useful.
In general macOS does not like files with execute permissions and refuses to edit bash
scripts, even though they are plain text.
-
I tried samba. I can connect to my Pi, but cannot edit any files, although I changed the permissions of them on the Pi. Do I need to do anything on my Mac? I have found samba the easiest. Jul 11, 2017 at 23:40
-
@NullCoderExists I can't comment on Samba (I haven't used it for years, and found it a PITA). Using
afp
I can edit most files (exceptions being those with execute permission - which means most on FAT partitions, and those in "protected" directories, which violate some macOS foible). In practice I copy files to the Mac, change permissions, restore copied file. This is also a PITA but, in practice, does not affect many files. Jul 12, 2017 at 0:05
You could use something called sshfs
which allows you to mount a distant volume. Install this on your Mac then you should be able to mount a distant (RPI) folder to your local file system (Mac)