green line
homephotoswoodfamilyericfaq

Mac OS X Perforce Server Setup



Note: These instructions are provided for reference only and are not guaranteed to be error free. It is your responsibility to verify that the steps outlined here will not cause damage to your computer, operating system configuration, files, etc. These instructions assume you are comfortable with using the Terminal application in Mac OS X and Unix shells in general.
  1. Create a new user account.
    1. Open the "System Preferences" Application. You will find this application in the "Applications" folder of your computer's hard drive.

    2. Choose "Accounts" from the "System" group.

    3. You should now have a window which will allow you to enter the account information. Below is an example of such a window. I highly reccomend that you set the short name to "perforce".

    4. Once you have the account setup click the "OK" button to close the window and then close "System Preferences" by choosing Quit from the System Preferences menu.

  2. Open a new shell become the "perforce" user by using the "su - perforce" command.

  3. Once in the perforce user's home directory create the following directories: bin, checkpoints, p4djournal, p4dlogs, p4droot, scripts. The P4_172.30.0.215_2200 directory is for a perforce proxy that I'm running, so, you will not need this directory. Notice also that I cleaned out all of the default directories except for the Desktop and Library directories.

    The following pictures shows you how my directories are setup in my perforce user's account.

  4. Now that the directories are setup you can being putting in scripts that are used to manage the server. In the figure below you will see the scripts I have in my scripts directory. You may download the p4d.sh and p4dcheckpoint.sh scripts that I use. Make sure that you change the IP address and port numbers to match you configuration. The IP number must be set to the IP address of the machine that will be running the server. I normally use port number 2200 for the perforce server. However, in the case of the p4d.sh script linked above a port number of 21 is used so clients on a machine that has most of it's ports closed can still connect to my perforce server. If you choose to do this you will need to run the perforce server as root because port 21 is a privileged port.

  5. The other directory that you will need to put files in is the bin directory. The picture below shows you the files that I have in my bin directory. The only file you will need is the p4d file. The best place to get this file is directly from download page at perforce.com. Make sure that you make the p4d file executable. You can do this by using the "chmod 744 p4d" command from within the bin directory.

  6. Starting the perforce server is very easy. If you are using a privileged port such as port 21, as I am, you will need to start your server as root. To become root type

    prompt> su -
    and press return. Then enter the root password when prompted. Now simply enter
    /Users/perforce/scripts/p4d.sh start
    You should see
    Perforce Server starting...
  7. To check that the server is running try using the p4 info command in a terminal where you are not root. If everything is ok you should see something like

    User name: eblom
    Client name: eric_g4
    Client host: pb12.local
    Client root: /Users/eric
    Current directory: /Users/eric
    Client address: 192.168.3.3:49287
    Server address: 192.168.3.3:21
    Server root: /Users/perforce/p4droot
    Server date: 2004/02/15 18:32:39 -0800 PST
    Server version: P4D/DARWINPPC/2003.1/46260 (2003/07/03)
    Server license: none
    
  8. If you would like your Perfroce server to start automatically when your machine boots. Do the following.

    prompt> su -
    prompt> cd /Library/StartupItems
    prompt> mkdir p4d
    prompt> cd p4d
    prompt> ln -s /Users/perforce/scripts/p4d.sh p4d
    prompt> vi StartupParameters.plist
    
    In the StartupParameters.plist file put the following. Now try rebooting your machine. After the reboot login, open a terminal, and try the p4 info command again.
bottom rule
Valid HTML 4.01! Send comments to
webmaster@piap.com