Make Homebrew installed Vim override system installed one

The output of both brew info vim and type -a vim clearly states that Homebrew provided version of vim is not installed on your system.

It appears that you have both ex-vi and mac-vim installed which are conflicting formula for vim. Trying to install vim by running brew install vim while ex-vi and mac-vim are installed results in the following error:

$ brew install vim
Error: Cannot install vim because conflicting formulae are installed.
  ex-vi: because vim and ex-vi both install bin/ex and bin/view

Please `brew unlink ex-vi` before continuing.

Unlinking removes a formula's symlinks from /usr/local. You can
link the formula again after the install finishes. You can --force this
install, but the build may fail or cause obscure side effects in the
resulting software.

If you wish to use the latest version of vim, you'll need to uninstall ex-vi and mac-vim by running:

brew uninstall ex-vi macvim

Now install vim by running brew install vim. Once the installation is successful, you can confirm the same by running type -a vim, which should output:

vim is /usr/local/bin/vim
vim is /usr/bin/vim

Resolution

The Homebrew installed vim was not linked. To link it requires running:

brew link vim

which gave the following error:

$brew link vim 
Linking /usr/local/Cellar/vim/8.1.1550... 
Error: Could not symlink share/man/de/man1/ex.1 
/usr/local/share/man/de/man1 is not writable.

The error can be resolved by fixing the permission by running:

sudo chown -R `whoami`:admin /usr/local/share/man/de/man1

Followed by finally attempting the link again by running:

brew link vim

This will link to Homebrew installed vim binaries under /usr/local/bin and thus Hombrew installed copy of vim will take precedence over system installed copy.


I was facing the same issue, I tried the solution proposed by @Nimesh Neema but the vim version was still showing older version. Apparently restarting the shell fixed it:

exec -l $SHELL

Before: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 19 2019 19:08:44) After: VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Feb 29 2020 01:58:02)