Archive for the 'Digital Nomad & Roamer' Category

Jan 23 2008

Mono and launchd on OS X

I finally managed to configure launchd on Mac OS X to launch an old project of mine, a news server written in C#, at boot time. The original code was written for .NET 1.1 and MSDE 2000 on Windows XP, and the current version runs on Mono 1.2.6_5 with MySQL 5.0.45 on Mac OS X Leopard.

Here’s what the .plist file for launchd looks like (it is actually stored in /Library/LaunchDaemons):

<?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>KeepAlive</key>
      <true/>
   <key>Label</key>
      <string>net.wmaus.nomad</string>
   <key>ProgramArguments</key>
      <array>
         <string>/usr/bin/mono</string>
         <string>/Users/Winni/Main.exe</string>
      </array>
   <key>RunAtLoad</key>
      <true/>
</dict>
</plist>

I use the filename net.wmaus.nomad.plist, and changed its owner via

   sudo chown root /Library/LaunchDaemons/net.wmaus.nomad.plist

Then I loaded my daemon via

   sudo launchctl load /Library/LaunchDaemons/net.wmaus.nomad.plist

After a reboot, I was able to connect to my NNTP daemon via Telnet:

   telnet localhost 119

   200 Welcome to the Digital Nomad News Server (GPL version).

YES! 🙂

For the record: I can now also work the same magic with a daemon written in BlitzMax.

One response so far