Upgrading vim on OSX

OSX ships with a respectable version of Vim, 7.0. I can’t remember why, but I had some reason where I needed to upgrade to the latest copy (currently 7.2). Here is how to do it:

In a terminal window, run the following commands:

svn co https://vim.svn.sourceforge.net/svnroot/vim/vim7
cd vim7
./configure
sudo make install

You will have to enter your password for the sudo command.

This will install a vim GUI in your Applications folder. In order to upgrade the vim in your terminal window, you have to run these commands:

sudo mv /usr/bin/vim /usr/bin/vim_original
sudo ln -s /usr/bin/vim /Applications/Vim.app/Contents/MacOS/Vim

Vim on the command line should now be updated to the latest version.

A side effect of this update is that your .vimrc file will be read from the more standard UNIX location of your home folder. To copy the OSX vimrc to your home folder so it can be read, run this command:

cp /usr/share/vim/vimrc ~/.vimrc