pain medication

Home > How To, Software > How To: Install the rsync daemon on Mac OS X

How To: Install the rsync daemon on Mac OS X

September 21st, 2009 Leave a comment Go to comments

Updated for Mac OS X 10.5 Leopard (using information from here:  http://www.designsolution.co.uk/resources/rsync/)
Before we start anything here, I’m going to give you a warning.

rsync can make a real mess of Mac OS files.

There, I said it. It wasn’t designed to handle resource forks or packages or the Mac’s icon storing arrangements. If you really need that, there’s another product called RsyncX which can do the job – but I’m not dealing with that app this time.

What is rsync?
The man page describes it as a “faster, flexible replacement for rcp”. Essentially, it’s an app used for copying files either locally, or to other hosts. It can synchronize directories, or individual file, and can maintain file permissions and owners along the way. If you’re a UNIX geek, it’s for you.
I’m not going to go into the details of exactly what it can do, and how it work – rather, I’m going to go through the process of running the rsync daemon on your machine. This will allow you to access your rsync “shares” from any other machine on your network at any time.

Requirements

  • Knowledge of the command line interface
  • Administrator access

Installation

Let’s begin.

1. First thing you want to do, is make sure you are an administrator on your mac. There’s not much point continuing if you’re not. You may need to use sudo to create some of the files below.

2. Open up Terminal and cd to /Library/LaunchDaemons

Here we’ll create a service definition which will allow the daemon to start (through launchd).

3. Download this file and copy it into the directory: http://maxpowerindustries.com/files/rsync.plist

(e.g. sudo cp ~/Downloads/rsync.plist .)

4. Check the directory and make sure the owner of the file is root, the group is wheel, and the permissions are rw-r–r–. Note: If the permissions are not correct, the daemon will not load. You can check if launchd is loading the module correctly by running: sudo launchctl load /Library/LaunchDaemons/rsync.plist

5. cd to /etc

6. Create a new file called rsyncd.conf

Here we create definitions for the various “shares” the rsync daemon will host.

[root]
   path = /
   hosts allow = 192.168.1.1
   uid = root
   gid = wheel
   read only = false
   comment = Root volume

Again, I won’t explain exactly what all the options are, but essentially, this creates a share called root which points to the root path of the volume ( / ), is readeadable/writeable, only allows connections from the host at 192.168.1.1, and uses root permissions. I wouldn’t grant permissions like this to a host unless you trust that host a whole lot.

If you’re not sure you want to be as extreme as the example above, try:

[websites]
   path = /web_sites
   comment = Web Site Directory for OS X

Save the file and exit your editor.

7. Check the directory and make sure the owner of the file is root, the group is wheel, and the permissions are rw-r—–.

8. Now we have everything we need run. I didn’t need to restart or do anything else – it just worked. If for some reason you can’t rsync right away, you may need to restart your machine or you can run:

sudo launchctl load -w /Library/LaunchDaemons/rsync.plist

9. The final step is to test the service. If you port scan (or nmap) your machine, you’ll probably see that the default rsync port is closed (port 873). Launchd will open the port when required. You may want to test the connection by running a basic rsync:

rsync -axv rsync://192.168.1.2/root/etc/hosts /tmp/
  1. Very Helpful
    January 12th, 2011 at 09:17 | #1

    This is so much more helpful than the “hey you can back up your Mac with rsync” posts I had to wade through to actually find this post.

  2. Constantin
    August 1st, 2012 at 01:36 | #2

    Thank you for that nice blog… it helped me a lot…

    there is also a nice GUI tool as a wrapper for rsync… itunes.apple.com/us/app/deployit/id432010738?mt=12 have a look 🙂

  3. Holger
    April 11th, 2013 at 08:33 | #3

    Thank you for this article! Your rsync.plist helped me very much!

  4. Edwin Jaufmann
    December 20th, 2013 at 20:00 | #4

    Thanks. This is great. Your sharing this is greatly appreciated.

  5. September 7th, 2016 at 04:04 | #5

    Nice article. I wrote Backaroo which is a GUI for exactly this http://bonhardcomputing.com/backaroo/
    Am currently wondering if a general purpose rsyncd GUI might be useful… i.e. not designed just for backups, but for all (get/put) file transfers. Not sure…

  1. February 7th, 2012 at 11:43 | #1
  2. February 7th, 2012 at 12:04 | #2