Simplicity and Clarity by Design

Perforce Launchd Configuration on Mac OS Tiger (10.4)

Mac OS Tiger introduced a new daemon control application called launchd. This application is supposed to take the place of rc scripts, xinitd scripts, and cron jobs. The launchd process is configured using XML text files that conform to the Apple plist DTD. Perforce does not provide a sample launchd configuration file for the p4d daemon.

The following is an example of how I configured p4d to run on my Tiger server. Be sure to edit it appropriately for your server configuration.

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

I place this file in the directory /Library/LaunchDaemons, and is named perforce.plist. The permissions look like this:

-rw-r-----    1 root  wheel   1012 Jan  5 22:21 perforce.plist

You will need to tell launchd about the new plist by running:

$ sudo launchctl load perforce.plist

from the /Library/LaunchDaemons directory. To confirm that the new plist has been loaded correctly you can run this command:

$ sudo launchctl list

The list produced should contain a line that says com.perforce.p4d. That is the name given to the new plist for the p4d application.
At this point you should see a p4d process if you run

$ ps -aux

There should only be one of this process running, and it is the daemon controlling your Perforce server installation.