The following is an excerpt of my .gitconfig

    editor = mvim
    autocrlf = false
    pager = less -FX
    commentchar = "#"
    tool = vimdiff
    guitool = vimdiff
    tool = vimdiff
    guitool = vimdiff
[mergetool "vimdiff"]

within this setup, I encountered the following problems:

  1. If I run git --config --global --edit I get the error: error: cannot run mvim: No such file or directory error: unable to start editor 'mvim' but output of where mvim is mvim: aliased to /Applications/MacVim.app/Contents/bin/mvim. The problem is solved by setting with git --config --global core.editor vim but this will use vim shipped with MacOS, which I don't want to use.

  2. I read somewhere that MacVim ship with its own version of Vim, but when I run where vim I only obtain /usr/bin/vim. How to make vim to point to the Vim version bundled in MacVim (if any)?

  3. vimdiff in [diff] and [merge] sections relate to vim shipped with MacOs. In the same line as in point 2., how to replace it to point to vimdiff bundled in MacVim? Note that output of where vimdiff is /usr/bin/vimdiff.

Macvim version is Vim 9.0.1276 (MacVim r176). I installed MacVim through its binaries (not brew).

1 Answer 1


mvim should be an actual script somewhere in your $PATH, not an alias.

With the way MacVim is currently built, it is as simple as prepending /Applications/MacVim.app/Contents/bin/ to your $PATH:

export PATH=/Applications/MacVim.app/Contents/bin:$PATH

which will give you direct access to vim, vimdiff, view, etc. as well as mvim, mvimdiff, mview, etc.

As explained in… :help mvim, under :help macvim.

Also, note that the vimdiff in merge.tool=vimdiff is not "the vimdiff executable or alias or whatever in my $PATH". It refers to a script that is part of Git.

As explained in… https://git-scm.com/docs/git-merge#Documentation/git-merge.txt-mergetool.

  • The command to get a local copy of the mergetool documentation is git help mergetool.
    – D. Ben Knoble
    Apr 29, 2023 at 15:20
  • The one for merge, the one I linked to in the answer, is $ git help merge, though.
    – romainl
    Apr 29, 2023 at 15:34
  • Fair enough; figured if we included :help style commands we could do similar for Git. The mergetool help also explains how to configure tool=vimdiff.
    – D. Ben Knoble
    Apr 29, 2023 at 15:41
  • 1
    I agree on principle but Vim's documentation is heavily tagged, which makes it pretty easy to point to a specific section without overwhelming the user. It's not 100% bulletproof but it works for most cases. man and info, on the other hand… "Go read those three paragraphs" versus "Your answer is somewhere in those six hundred lines, go read them". Git's online help has a clear edge over man, here.
    – romainl
    Apr 29, 2023 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.