How to get p4merge to come up when I do git mergetool?

I did setup p4merge using this in my .gitconfig:

[merge]
    tool = p4mergetool
    stat = true
[mergetool "p4mergetool"]
    cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "$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/Resources/launchp4merge "$LOCAL" "$REMOTE"
    keepBackup = false
    keepTemporaries = false
    trustExitCode = false
    prompt = false

When I try to git mergetool in my project it can find the conflicted files and open p4merge tool but it open to choose the files, not with the conflicted file opened. How to solve this?

My versions:
Git 2.23.
Latest p4merge version P4Merge/MACOSX1015X86_64/2020.2/1999419.
macOS Mojave 10.14.6


Solution 1:

I just solved it! The definitions of cmd should be

cmd = /Applications/p4merge.app/Contents/MacOS/p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
...
cmd = /Applications/p4merge.app/Contents/MacOS/p4merge "$LOCAL" "$REMOTE"