Install Vim with Homebrew Python on OS X

For people that need full features of vim, the default installation of vim on Mac OS X is definitely not enough. For example, I need to use vim to post to this blog, which requires a version of vim with python support. I also prefer terminal version of vim to the GUI version, so MacVim is less desirable.

One way to get what I want is to compile a version of vim with homebrew. Homebrew does not officially have a vim fomula, because that would be a duplicate of the system version. Fortunately, we can grab an unofficial formula at

Also, you may want to install the latest homebrew python with the framework option:

brew install python --framework

In order for vim to use the homebrew version of python (2.7.3) instead of the system one (an old 2.6), we need to change a line and add a line in the downloaded formula (vim.rb) file:


Now install vim with the formula:

brew install ./vim.rb

To check vim is using the correct version of python. Issue command in vim:

:python import sys; print sys.version

If we get something like this:

2.7.3 (default, May 15 2012, 20:51:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
Press ENTER or type command to continue

we are done!


Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account associated with the e-mail address you provide, it will be used to display your avatar.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <div> <h1><h2><h3><sub><sup><b><i><u><font><img>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Lines and paragraphs break automatically.

More information about formatting options

To prevent automated spam submissions leave this field empty.
Nice place