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" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>GroupName</key> <string>perforce</string> <key>Label</key> <string>com.perforce.p4d</string> <key>OnDemand</key> <false/> <key>Program</key> <string>/usr/local/bin/p4d</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/p4d</string> <string>-r</string> <string>/Depot</string> <string>-p</string> <string>1666</string> <string>-J</string> <string>/Depot/journal</string> <string>-L</string> <string>/Depot/p4err</string> </array> <key>RunAtLoad</key> <true/> <key>ServiceDescription</key> <string>Perforce Daemon</string> <key>StandardErrorPath</key> <string>/Depot/p4d.stderr.txt</string> <key>StandardOutPath</key> <string>/Depot/p4d.stdout.txt</string> <key>UserName</key> <string>p4admin</string> <key>WorkingDirectory</key> <string>/Depot</string> </dict> </plist>
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.