gitqtdifftoolp4merge

Git Difftool problem with qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in ""


I cannot get 'git difftool' to launch P4merge after installing P4merge on my Mac (mac0S 10.13) via the vendor package from the website (rather than Home brew) and configuring my 'git config --global' file like this:

[user]
name = (my name)
email = (my email)
[core]
editor = mate -w
[alias]
hist = log --all --graph --decorate --oneline
[diff]
tool = p4merge
[difftool "p4merge"]
path = /Applications/p4merge.app/Contents/MacOs/p4merge
[difftool]
prompt = false
[merge]
tool = p4merge
[mergetool "p4merge"]
path = /Applications/p4merge.app/Contents/MacOs/p4merge
[mergetool]
prompt = false

When I run 'git difftool', instead of P4merge opening, I get an alert saying that "p4merge quit unexpectedly" and the following message in Terminal:

qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
/usr/local/Cellar/git/2.26.0/libexec/git-core/mergetools/p4merge: line 1: 22662 Abort trap: 6 "$merge_tool_path" "$LOCAL" "$REMOTE"

I have tried to uninstall and reinstall p4merge. P4merge works if I double click the app and do not try to use it from within git.

Thanks. This is my first issue, so if I'm posting it incorrectly, please let me know! There are numerous questions similar to this, but most seem to be connected with Python and not the same as mine.

Dug Steer


Solution

  • The answer here lies in changing the path to git difftool in the git config file. I came up with this after reading Command Line P4 merge on MacOsX. Altering the path to /Applications/p4merge.app/Contents/Resources/launchp4merge causes "git diff" and "git difftool" to work as expected, the first showing up differences in git status files in the terminal, the second opening both files in P4merge.

    gitcofig --global