Cover your eyes, you’re about to see some blatant XML abuse. With your eyes closed, create the file /Library/LaunchDaemons/ruby.gem.server.plist and place this into the file:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key><string>ruby.gem.server</string> <key>ProgramArguments</key><array><string>/usr/bin/gem</string><string>server</string></array> <key>KeepAlive</key><true/> <key>RunAtLoad</key><true/> </dict> </plist>
Save and open your eyes. From the command line, change ownership on the file, and load to launchd:
$ chown root:wheel /Library/LaunchDaemons/ruby.gem.server.plist $ launchctl launchd% load /Library/LaunchDaemons/ruby.gem.server.plist launchd% exit
Open your browser to http://localhost:8808/. Bask in the glory.
Update: Or you can just use Lingon which reduces all of this to a few clicks, no need for XML or chown heroics (thanks Matt).