Download and Install P4V
Download the free Perforce Visual Client dmg from here. Once it’s downloaded, copy p4merge
from the disk image to your /Applications
directory.
Write some simple shell scripts
p4merge*
Create a new text file in /usr/local/bin
called p4merge
and add the following lines:
#!/bin/sh
/Applications/p4merge.app/Contents/MacOS/p4merge $*
Make the script executable by entering this command:
chmod +x p4merge
p4diff*
Create a new text file in /usr/local/bin
called p4diff
and add the following lines:
#!/bin/sh
[ $# -eq 7 ] && /usr/local/bin/p4merge "$2" "$5"
Make the script executable by entering this command:
chmod +x p4diff
Configure Git to use the scripts
Open your git configuration file (probably ~/.gitconig
) and add these lines:
[merge]
keepBackup = false;
tool = p4merge
[mergetool "p4merge"]
cmd = p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
prompt = false
keepTemporaries = false
trustExitCode = false
keepBackup = false
[diff]
external = p4diff