Perforce Games

Getting Perforce to run on my Mac has been both frustrating and exciting, but not all that easy.

Actually the demo was extremely easy. That was very well done. And I really respect the Perforce guys for basically giving their software away from MicroDev's - a two user license is FREE. How cool is that? And they do support the Mac so I can't complain that much.

But here's what I've learned.

Rename and Install

The two key apps in Perforce are p4d ande p4. When you download these, they will have a .exe extension (sigh it's a windows world). First, rename them to get rid of the .exe. Then you have to make them executable.

chmnod +x p4
chmod +x p4d

The p4 program belongs in the /usr/local/bin directory, so I just did a

sudo cp p4 /user/local/bin

and I had to edit my .bash_profile to make sure that /usr/local/bin was in my path. But that's not all.

Tell P4 How to Find the Server

Also you will need to tell p4 how to find the Server (setting up the server in a second). To do that you need to add a few lines to that .bash_profile. Namely you want to set:

export P4HOST=localhost
export P4PORT=1666
export P4CLIENT=localhost
export P4USER=scottnovis

Set your own username of course.

Setting up the server

I decided that the best way to handle the server was to create a perforce account. So I used AppleMenu>System Preferences>Accounts to create an accounted named perforce. Then I copied p4d into that directory. It's a bit silly because the Mac created a bunch of subdirectories (like Music, Pictures and Documents) but I just rand p4d from the root with:

p4d &

I did edit the .bash_profile in the perforce account to make sure the environment variables P4HOST and P4PORT were set.

Command Line Works like a Champ

So without the server settings, if you try to run p4 you get nothing… but once it's set, you can do some stuff. Here's what I have so far:

p4 -h

Prints command line args for p4

p4 help

Prints detailed help of Perforce commands

p4 user scottnovis

Creates a user account for ScottNovis. Note: the way this works is that the current $VISUAL editor is called up (vim) for me, and you edit a temporary text file. When you save quit (:wq) p4 takes the form back and uses that information to update perforce.

I don't know all the commands to really work with files from the command line yet.

P4V

The real app you want to use is P4V. This is distributed on the mac as a dmg and it's a genuine Coaco Mac OS X app. The big trouble I'm having here is that my $HOSTNAME is NOT localhost and so the p4 commands are failing. Basically p4v won't work for me. It worked with the demo… but it won't work at work with the wacky host name I get from plugging into the company networking and getting an IP from their DHCP server.

Okay, here's what I learned. The configuration files Client and Workspace determine who can get to a depot. Because I had specified host names in my workspace definition, I couldn't get to it with my $HOSTNAME not matching what I entered. The solution?

p4 workspace workspace

Find the line that says Host: and I deleted it and saved the file.

Now p4v works like a champ.

Very cool.

Useful Perforce Links

There is a document on how to fire up Perforce from the inet.d so you don't have to do it by hand every time.

http://www.perforce.com/perforce/doc.current/manuals/p4sag/03_superuser.html

perforcegames.txt · Last modified: 2007/02/22 20:35 by scott
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0