Note: this post details the process I took to install Vim 7.4 on Mac OS X 10.9 (Mavericks). I make no guarantees that this process will work with your setup or that it won’t mess something up horribly (see this post for more discussion on the why or why you would not want to do this). The is merely me documenting the steps I took on my own system to get the latest version of Vim compiled and installed.

The version of Vim that ships with Mavericks OS X 10.9 is 7.3 (you can confirm the version you are using as soon as you launch Vim from the command line). Sadly, there are plenty of features/fixes that came with 7.4. In particular I wanted the breakindent setting that allows HTML lines of text to span multiple visual wrapped lines in a sane manner.

Here are the steps I took to compile the latest version of Vim from source and get it setup on my system.

Since writing this post a couple of people have pointed out other ways to get the latest Vim installed. Most people suggested using Homebrew and the command brew install vim. However, when I attempted this it didn’t work (various permissions issues). Perhaps the simplest way to get the latest version working is to download the latest MacVim and then enter an alias in your .zshrc file: alias vim="/Users/benfrain/MacVim/'. Amend that to the path you install MacVim. That is the most hassle free way I have come across to get the latest and greatest Vim running regardless of the machine setup!

First of all, you’ll need to have the Homebrew package manager installed on your system. In case you don’t have Homebrew installed, you can paste this one-liner into your Terminal:

ruby -e "$(curl -fsSL"

You’ll also need Mercurial, as that’s the version control system that the Vim source is kept in. We have Homebrew now so that’s easy from the Terminal:

brew install mercurial

I would also recommend ensuring you have the xcode command line tools installed. You can fire that off from Terminal too:

xcode-select --install

Follow the install through and then we’re ready to take a shot at this.

OK, assuming we are in Terminal/iTerm now, let’s do this step-by-step. First we want to move into the user root:

cd ~/

If you have failed to install previously you may want to remove any existing Vim folders:

sudo rm -rf vim (you’ll need to enter your password)

Now we will use Mercurial to pull down the latest Vim from source and copy it into a folder called ‘vim’ in the user root:

hg clone vim

Now we want to move into that folder:

cd vim

Now we want to configure Vim. I’m choosing the largest feature set (no reason not to on modern systems) and I also wanted python support enabled – one of the plugins I use depends upon that. You therefore may not need the --enable-pythoninterp part:

./configure --with-features=huge --enable-pythoninterp

Vim will be configured now so we just need to make and install it:

sudo make && make install

Now the latest Vim should be installed and configured. Launch Vim and check the version number. If you are still seeing the prior version, it’s probable you will need to amend your settings so that your system looks in the correct location for the most up to date version.

I achieved this by amending the following line in my .zshrc file (the file also lives in the user root if you use ZSH as your Shell):

export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"


export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Basically just ensuring that the /usr/local/bin was used first. Depending on your Shell, your setting may need to be changed elsewhere. However, once the paths are set correctly, re-launching Vim should confirm the latest version is being used. You can also check the installed features by running :version from command mode of Vim.

If you are using plugins via a plugin manager such as Vundle, you may just need to re-install your plugins (at the time of writing I’s using Vundle so it was :PluginInstall for me).

Hopefully I can now wish you ‘Happy Vimming’!