How to upgrade system default vim?
Solution 1:
Get the Homebrew* package manager.
Install vim
formula (as of today it is Vim 8.0.2) with:
brew install vim
Check the messages it produced for any manual actions you might be required to perform, although with Vim formula there should be no issues.
One more thing you should do is to check your environment variables for those that might contain a full path to the system vi
/vim
, like EDITOR
and update them to use the /usr/local/bin/vim
.
If you had Homebrew already installed, before running the install command, update the local repository with:
brew update
If you had Vim already installed with Homebrew (or if in the future you'd like to upgrade the Vim version), then run:
brew upgrade vim
* Homebrew is an open-source, actively maintained package manager for Mac OS X. It keeps the packages in /usr/local/Cellar
folder by default. It stores links to the executable files /usr/local/bin
and puts this directory ahead of system directories in the PATH
environment variable. Your /usr/bin/vim
can thus be left alone.
Homebrew will also take care of all the paths and dependencies for installed packages.
Solution 2:
You can install vim with Homebrew overriding the current system's vim with the --with-override-system-vi
:
brew install vim -- --with-override-system-vi
Remember to restart your terminal after that to make sure the new symbolic links work as expected.