Skip to content

Startup Script for Mac OS X

CodingTwinky edited this page May 1, 2016 · 7 revisions

Introduction

By default, ungit needs to be run from the command line. At times, it is more useful to simply have it start as a background daemon when the system starts up. This script allows you to do just that on Mac OS/X.

Disclaimer

This method isn't officially supported by the ungit developers.

Installation

  • Install ungit as described in README.md at root
  • Make links to both node and ungit:
$ sudo ln -s `which node` /usr/bin
$ sudo ln -s `which ungit` /usr/bin
  • Add the following new launchctl script to ~/Library/LaunchAgents/com.fredriknoren.ungit.plist (you may need to create this directory):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.fredriknoren.ungit</string>

    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/ungit</string>
        <string>--cliconfigonly</string>
    </array>

    <key>StandardOutPath</key>
    <string>/var/log/ungit.log</string>
    <key>StandardErrorPath</key>
    <string>/var/log/ungit.log</string>

    <key>Debug</key>
    <true />

    <key>KeepAlive</key>
    <true/>
</dict>
</plist>
  • Change file ownership
$ sudo chown root ~/Library/LaunchAgents/com.fredriknoren.ungit.plist
  • Start using launchctl:
$ sudo launchctl load ~/Library/LaunchAgents/com.fredriknoren.ungit.plist

Debugging

If you encounter troubles with the script starting, try looking in the log file, located (by default) at /var/log/ungit.log.

Clone this wiki locally