Mac OS X launchd To Keep Ghost Alive

On Mac OS X, the preferred way to start a service and to keep a service alive is launchd. The following steps will show you how to create a launchd script to start ghost when your computer starts up, and relaunch ghost if it crashes.

sudo vi /Library/LaunchDaemons/com.ghost.start.plist

Paste the following into your com.ghost.start.plist launchd (change /Ghost/ to the path to your ghost folder):

<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
    <plist version="1.0">

Save your launchd and then load it:

sudo launchctl load -w /Library/LaunchDaemons/com.ghost.start.plist 

If you want to test, run:

sudo ps aux | grep npm | grep -v grep | kill `awk {' print $2 '}`