/Developer/Applications/FileMerge.app to /Developer/Applications/Utilities/FileMerge.app in both scripts. Use your favorite editor[1] to create the following shell script:
#!/bin/sh # This makes FileMerge work with Perforce (unlike opendiff, which forks and doesn't wait). # Note: We save the merged file in the checked-out copy (same as -right) /Developer/Applications/FileMerge.app/Contents/MacOS/FileMerge -left $1 -right $2 -merge $2
Save this as /usr/local/bin/p4diff then chmod +x /usr/local/bin/p4diff to make it executable. Set the environment variable P4DIFF=/usr/local/bin/p4diff to let Perforce see it. You may need to poke your shell (if you know what I mean ... you know, rehash for tcsh, or hash -d for bash or open a new terminal window) the first time.
Now, assuming you have the p4 command line client installed,[2] and that you installed the Mac OS X developer tools,[3] you can type p4 diff [some-file] and it'll use FileMerge to show the diffs. Preeeetty. By the way, you can use the arrow keys to select which version you like, and if you save the diffs, it will modify your edited file. That's a really handy way to back out a few sections without undoing the whole file.
You can do the same trick for the related p4 merge command with the following script:
#!/bin/sh # This makes FileMerge work with Perforce for P4MERGE (unlike opendiff, which forks and doesn't wait). # p4 docs say the call is P4MERGE base theirs yours merge # We give that to FileMerge as -left theirs -right yours -ancestor base -merge merge /Developer/Applications/FileMerge.app/Contents/MacOS/FileMerge -left $2 -right $3 -ancestor $1 -merge $4
Save it as /usr/local/bin/p4merge then chmod it, point the P4MERGE environment variable at it, and suddenly Robert is the brother of one of your parents.
[2] If you don't have the Perforce command-line client installed, get thee to the downloads section of http://www.perforce.com and get it. By the way, I use the Darwin client because it uses UNIX file protection for file locking instead of the Mac OS X client which uses the HFS lock flag, the former is a little easier to read and manipulate from the terminal.
[3] Seriously, if you don't have the developer tools installed, why are you even reading this page? Go sign up for a free account at http://connect.apple.com and get the latest tools.
Wow, a one page HOWTO with three footnotes. Hey, my writing style is non-linear, why should your reading style be any different?