Fossil Server on OS X with launchd Tue, Jul 23, 2013

Previously our antagonist had switched to using fossil instead of Mercurial and Trac. The next step was serving all my various little projects on my home network so they would be easy to browse and sync between laptop and iMac. Shouldn’t be a problem, just add a line to inetd.conf to kick off the fossil http command when receiving a request on a given port. Done.

It had been quite a few years since I had configured inetd, but I thought what the heck! It can’t be that hard - except - no (x)inetd on OS X these days. It’s all controlled by launchd now and I couldn’t help but feel I was stropping my blade in preparation to shave the yak. Turns out it wasn’t nearly as bad as I thought. A few trips through the man pages. A search or two on stackoverflow and skadoosh.

Here it is.

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

Hitting my iMac on the local network on port 7660 will serve all the fossil repositories in /Users/username/repos. http://imac.local:7660/work would open the work.fossil in the repos directory. Now it’s time to get something done.

Update: Copy & Paste Fail

Shorty after posting I realized a whole section had been left out. It is missing from my original draft document, so I surmise that while copying the sections over I missed the all important How to load this in launchd? question.

Save the above XML file as ~/Library/LaunchAgents/fossil.plist which will load the configuration every time the system is started. To load it immediately do a launchctl load ~/Library/LaunchAgents/fossil.plist

That’s what I get for blogging while tired.