0

I'm on macOS Mojave, Git version 2.19.0

When doing git mergetool, instead of p4merge, filemerge comes up.

Searched my entire drive and the only instance of p4merge I see is in

/Applications/Sourcetree.app/Contents/Resources/git_local/libexec/git-core/mergetools/p4merge

Am I missing something, I think perhaps I need to install p4merge or something..

Here is what I have done already:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null ; brew install caskroom/cask/brew-cask 2> /dev/null

brew cask install p4merge

When I do run the above command I get an error:

(master) ✚ >M< > brew cask install p4merge
Ignoring commonmarker-0.17.11 because its extensions are not built.  Try: gem pristine commonmarker --version 0.17.11
Ignoring commonmarker-0.17.11 because its extensions are not built.  Try: gem pristine commonmarker --version 0.17.11
Ignoring commonmarker-0.17.11 because its extensions are not built.  Try: gem pristine commonmarker --version 0.17.11
Updating Homebrew...
Ignoring commonmarker-0.17.11 because its extensions are not built.  Try: gem pristine commonmarker --version 0.17.11
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
conan

Error: Cask 'p4merge' is unavailable: No Cask with this name exists.
  • What is p4merge? It is not a standard Apple or git tool – Mark Oct 19 '18 at 18:04
  • It's a tool to view the differences between git commits. When you want to view the differences in graphical format, that is what you use when you issue the command git mergetool. I'm doing it on macOSX. – Stryker Oct 19 '18 at 19:09
  • So the qustion is really - How do I get p4merge? and nothing to do with git – Mark Oct 19 '18 at 20:21
  • @mark p4merge is directly related to git commit differences. You can also use difftool but p4merge gives u a visual output put. I’m not sure if u can even use p4merge in its own – Stryker Oct 19 '18 at 21:36
  • p4merge is not a part of git - it is part of Perforce version control which you pay for. You can use it with git. – Mark Oct 20 '18 at 11:12
1

It would be best to install p4merge directly from their vendor as their brew cask is not maintained by the authors. First download p4merge and drag & drop to your applications from their download page: https://www.perforce.com/downloads/visual-merge-tool

After p4merge.app is under /Applications you can configure git to use p4merge as default merge and diff tool.

There is active discussion in this gist document, better check the latest developments from there https://gist.github.com/tony4d/3454372

You can use the following configuration for Mojave.

[merge]
    tool = p4mergetool
    stat = true
[mergetool "p4mergetool"]
    cmd = /Applications/p4merge.app/Contents/MacOS/p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
    keepBackup = false
    keepTemporaries = false
    trustExitCode = false
    prompt = false
[diff]
    tool = p4mergetool
    renames = copies
    mnemonicprefix = true
[difftool "p4mergetool"]
    cmd = /Applications/p4merge.app/Contents/MacOS/p4merge "$LOCAL" "$REMOTE"
    keepBackup = false
    keepTemporaries = false
    trustExitCode = false
    prompt = false
  • This does not answer the issue as the OP has not managed to install p4merge and even if they had done so it would not be under /Applications as they art using Homebrew – Mark Dec 18 '18 at 14:10
  • I totally misunderstood it. This answer was one of the search results for making p4merge work for Mojave and it's not a straightforward task. I updated the answer to include how to install p4merge properly though without using brew. – Halil Kaskavalci Dec 19 '18 at 10:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .