Anand
Anand

Reputation: 121

Upgrade to Vim 7.4 in OS X El Capitan

I am new to Vim but am determined to learn it. I am on OS X El Capitan and have tried upgrading Vim 7.3 to 7.4 using several options but with no success.

I have used brew install with --with-system-override-vim option but although I can see that vim 7.4 is installed when I start my Vim editor it again reverts back to 7.3 version only.

Can anyone please guide me through the process of making sure that the system version is upgraded to 7.4.

Upvotes: 4

Views: 9764

Answers (3)

wisbucky
wisbucky

Reputation: 38023

Don't replace the system vi/vim in /usr/bin. Instead, use homebrew to install a newer version of vim:

brew update
brew install vim

That will install a newer vim to /usr/local/bin/vim. Make sure that your $PATH has /usr/local/bin before /usr/bin. You would probably also want to add a symlink for vi in /usr/local/bin as well:

ln -s /usr/local/bin/vim /usr/local/bin/vi

which vim # verify that it is /usr/local/bin/vim
which vi # verify that it is /usr/local/bin/vi

Upvotes: 0

sambua
sambua

Reputation: 2654

@dursk answer is correct, but I didn't have "/usr/local/bin/vim". My solution was to upgrade to latest version of MacVim it's 8.0 now ( http://macvim-dev.github.io/macvim/) install MacVim via .dmg file

after adding line below to .bash_profile file in user root folder

alias vim="/Applications/MacVim.app/Contents/MacOS/Vim"

After should run command source ~/.bash_profile to update bash_profile settings

Upvotes: 0

dursk
dursk

Reputation: 4445

Pretty sure homebrew installs vim under /usr/local/bin/

You really shouldn't overwrite the system vim, you should an alias to your .bash_profile file,

alias vim='/usr/local/bin/vim'

The other option would be to "hide" the current vim

mv /usr/bin/vim /usr/bin/vim73

And then when you run the vim command it won't find it under /usr/bin/ and will look in /usr/local/bin/

Upvotes: 5

Related Questions