I've installed macvim on OSX 10.11.6 using brew install macvim --with-override-system-vim. This worked fine. I now have some new aliases/symlinks (I'm not too familiar with the differences):

#in usr/local/bin
vim -> ../Cellar/macvim/8.0-119_1/bin/vim
mvim -> ../Cellar/macvim/8.0-119_1/bin/mvim
#in usr/local/Cellar/macvim/8.0-119_1/bin/
vim -> mvim
mvim                                            #executable

vim opens vim in the terminal window (the updated version of vim, not OSX's). mvim opens macvim with its own window.

If vim is an alias for mvim, how does the machine know to run plain old vim when I type vim? Is it changing my command to mvim -v behind the scenes? If so, is this -v in the alias/symlink somewhere?

Any insight you all have be would be great.

1 Answer 1


mvim is a shell script which uses the name it's run as to decide what to do:

# Next, peek at the name used to invoke this script, and set options
# accordingly.

name="`basename "$0"`"

# GUI mode, implies forking
case "$name" in m*|g*|rm*|rg*) gui=true ;; esac

This is not uncommon. Vim itself reacts differently on whether it is invoked as vim, vi, vimdiff, gvim, etc.

So, running mvim as vim just runs "$VIM_APP_DIR/MacVim.app/Contents/MacOS/Vim" as it is, whereas running as mvim runs "$VIM_APP_DIR/MacVim.app/Contents/MacOS/Vim" -g.

Also see:

  • Ahh! So that's why mvim is so small? I never noticed it was only 2 kb, way too small to be the "main vim" getting launched. Thanks so much. Dec 24, 2016 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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