Using Git on macOS is largely a positive experience, other than (in my opinion) the out of the box experience with merge tools. With my recent merge to Homebrew Cask you can use p4merge with no extra work.


Assuming you’re already using Homebrew, just install p4v

brew cask install p4v

and then configure p4merge as the default mergetool

git config --global merge.tool p4merge

Now whenever you run git mergetool, you’ll be presented with p4merge.

How does it work?

My change to the Homebrew package basically just inject a simple wrapper script like below
set -euo pipefail
COMMAND=$(basename "$0")
exec "/Applications/${COMMAND}.app/Contents/MacOS/${COMMAND}" $@ 2> /dev/null
for each of the Perforce applications included in the installer.

This wrapper script basically allows the embedded Qt installation to detect the correct path to load itself from. If you try a symlink, it will see its path as /usr/local/bin, and try and load Qt from there, which won’t work.

With the wrappers installed, you no-longer need to write any of your own, or set fiddly git config to make it work.