Any ROS based system needs ROSCore running to provide the basic OS services. My home automation building operating system is no different and for an always on, building operating system, you really want everything to run as a daemon. However, my only always on wired ethernet server is a Mac Mini, not an Ubuntu server so I figured out how to get ROSCore to run as a daemon on OSX.
Installing ROS on OSX
To start with, I followed the ROS wiki directions for installing ROS Hydro on OSX via Homebrew. I’m running OSX 10.6 and had minimal difficulties getting it to work. My only problems came from making sure to follow the directions for Ros Hydro and not mixing in steps from other ROS versions which are linked to in the wiki.
Creating an OSX Daemon
Making a daemon requires two parts, a shell script to run and a plist to install in /Library/LaunchDaemons.
The shell script sets up the environment to run ROSCore just as you would have the environment set up if you were running it manually. The plist tells OSX how to run the script as a daemon.
I created a dedicated user to home automation daemons named artifice so I put roscore.command in /Users/artifice. I then copied roscore_daemon.plist to /Library/LaunchDaemons and changed the ownership to root:wheel and permissions to 644 which is required for the OS to execute a daemon.
Remaining issues
My one complaint now is that when I occasionally need to reboot my server, I have to restart all the ROS nodes running on other machines. This isn’t a Mac specific problem so much as a problem with the way ROS is structured, the network doesn’t really heal very well. For now I am using bootup scripts on the mac to cause it to make other nodes restart outside of the ROS framework. If anyone has a better method, I would love to hear it.