Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For example, when the server boots I need to start Tomcat, and I need to start an Android emulator, and then issue some commands to it. These are on the path already. I'm familiar with Linux and understand the basics of Daemons, and I suspect it will be something similar?

share|improve this question
up vote 2 down vote accepted

LaunchDaemons are the preferred way to do this in OS X. Each daemon is controlled by a .plist file in /Library/LaunchDaemons (for add-on daemons; the builtin daemons are in /System/Library/LaunchDaemons) which specifies when to start the daemon (e.g. on load, when a connection is received on a TCP port, at certain times, etc), what command and arguments to use to start the daemon, etc. See the Apple developer docs here, and look in /System/Library/LaunchDaemons for examples.

One big warning if you're used to using other startup systems: by default, launchd expects programs it starts to not daemonize themselves. This page suggests starting Tomcat with a launchd plist named /Library/LaunchDaemons/org.apache.tomcat.plist containing:

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

(Note that is told to "run", not "start".)

If you need to launch something that cannot be prevented from daemonizing, you'll need to add something like this to the .plist:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.