Using homebrew I installed MacVim 7.3, but when typing "vim" in terminal it points met to 7.2 version that I installed by downloading MacVim from the web. I must have installed it a while ago and set a symlink to vim.

Cannot figure out how to change that symlink to point to vim 7.3 instead of 7.2?

migrated from stackoverflow.com Jun 27 '11 at 3:44

This question came from our site for professional and enthusiast programmers.


It is more a workaround than a real solution but you could add an alias to your ~/.profile or ~/.bashrc pointing to the newest Vim:

alias vim='/path/to/new/vim'

But the real solution is to search your path (with Finder.app or on the command line) for older versions of Vim.

The older MacVim will probably be in /Applications or ~/Applications, start by deleting it.

I see no good reason for having a symlink pointing to MacVim's vim but if you have made one a simple search would find it quickly.

  • Had no affect. Still points to old vim. If I type-in alias in terminal it recognizes the new path, but forgets it each time I open new session. I have removed the older vim version from /Applications folder. As you point out it is more of a superuser question, but I am no expert in Mac. Anyway I would love to figure out how to solve the problem. – Edijs Petersons Jun 26 '11 at 20:55
  • Remove all the alias vim= and type which vim, what does it say? – romainl Jun 27 '11 at 6:51
  • What is the output of $ sudo find / -name vim? (I don't think sudo is really mandatory since find does nothing to files and directories but some of the bundles in my /Applications folder have bizarre authorization settings) – romainl Jun 27 '11 at 6:59
  • Thanks for involvement, really appreciate it. sudo find returned multiple matches, but here is what I did before that. Removed /usr/bin/vim and my vim command was not recognized anymore. If I add in terminal (btw I used iTerm2) window alias I can use vim command: alias vim="mvim -v" vim open_some_file If I modify ~/.bashrc or/and ~/.profile by one of these combination, vim command is not recognized: alias vim="/Applications/MacVim-7_3-53/MacVim.app/Contents/MacOS/Vim" alias vim="mvim -v" – Edijs Petersons Jun 27 '11 at 18:50
  • Then I tried creating link, and it does recognize vim command, but then it fails to load .vimrc settings and complains about missing colors: sudo ln -s /Applications/MacVim-7_3-53/MacVim.app/Contents/MacOS/Vim /usr/bin/vim My only goal was to use "vim" command instead of typing "mvim -v". You mentioned that symlink to MacVim is not a good idea. Obviously I am missing some basic concepts here and would be glad if you could enlighten me. – Edijs Petersons Jun 27 '11 at 18:54

Where did you install mvim, and the symlink? It might be /usr/local/bin/. This case I think it is possibly because the old /usr/bin/vim goes before the location in PATH. You can find out which will be call when you run vim by which vim, or try to rename stock vim by rename it to something like vim72. If that works then you can rename it back and try to set /usr/local/bin/ goes before /usr/bin in the PATH

  • Yes, the /usr/bin is indeed before /usr/local/bin. But I solved the issue by adding alias to ~/.bash_profile. Would you still recommend putting /usr/bin before /usr/local/bin or normally that should not matter? – Edijs Petersons Jun 28 '11 at 20:40
  • You should put the path that leads to the most recent version of Vim before the older one since your shell will launch the first it finds. You can put other exotic paths there too. Like ~/Applicationsfor example. – romainl Jun 30 '11 at 6:51
  • Yes I still recommend putting all your custom paths before OS's ones. This is useful when you're using your dotfiles in different OSes. Setting the PATH right will works for Linux and Mac OS X, while aliasing only works for Mac OS X (It breaks even when you install MacVim in a different place!). – tungd Jun 30 '11 at 12:55

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.