Apple vim always used instead of homegrown

I see something very strange, and to be honest, I'm at a standstill.

The version of vim that ships with mac is deprecated (7.3 instead of 7.4). I am trying to install vim from homebrew and I want to use this option instead of the standard version of Apple.

I ran " brew install vim ". It is correctly installed in /usr/local/bin/vim . Things are good.

When I run " which vim ", it prints " /usr/local/bin/vim ". Apple's vim version is installed in /usr/bin/vim . So which team tells me that I am using the vim version for homebrew.

However, when I do run vim, it still launches the Apple version

 $ vim --version VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jul 9 2015 23:58:42) Compiled by root@apple.com ... 

If I launch the homebrew version explicitly, I see the following:

 $ /usr/local/bin/vim --version VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Oct 23 2015 18:16:35) MacOS X (unix) version Included patches: 1-898 Compiled by Homebrew ... 

I even tried moving /usr/bin/vim to /usr/bin/vim73 to try to force use the version of homebrew. However, when I did this, here is what I see when I try to start vim:

 $ vim --version -bash: /usr/bin/vim: No such file or directory $ 

What's happening? How can I get it to run the home version of vim?

+8
vim homebrew path osx-yosemite macos
source share
2 answers

Start a new shell session and it will work.

Bash caches executable paths, so when you run vim it looks at your PATH to find the first executable with that name. It caches it, and the second time you start vim , it remembers vim actually /usr/bin/vim and starts it.

Since you did not restart the Bash session, its cache remains the same; hence the error you see. This has nothing to do with how you installed vim .

+16
source share

You forgot the argument:

 $ brew install vim --override-system-vi 
+2
source share

All Articles