Poweline, Python and YouCompleteMe on OSX with Homebrew

This was a lot harder than I thought. The problem is that in order to have sane version of Python (for Powerline) you also need to compile YCM with the same Python. This is what worked for me.

  1. Install python via homebrew: brew install python
  2. Add a config file to allow the --user flag when installing powerline with pip (see here: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Homebrew-and-Python.md#note-on-pip-install---user for why) $ vim ~/.pydistutils.cfg and add

  3. Now install powerline with:

    pip install --user git+git://github.com/powerline/powerline
  4. Install YouCompleteMe (assuming Pathogen, and that your Vim meets the requirements innit):

    git clone https://github.com/Valloric/YouCompleteMe.git
    cd ~/.vim/bundle/YouCompleteMe
    git submodule update --init --recursive

Then (following a mashup of these instructions: https://github.com/Valloric/YouCompleteMe/issues/18#issuecomment-88395165) make sure that we use at least Python 2.7 and our homebrewed Python.

    sed -i '' -E 's/(Python[a-zA-Z]+) 2.6 REQUIRED/\1 2.7 REQUIRED/' third_party/ycmd/cpp/ycm/CMakeLists.txt 
    env PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin/ bash install.sh

After all that you should be able to run vim without any nasty errors and python crashing out.


Well, yeah. Why not install macvim? Why install powerline? Well, because in the quest for vim awesome you must go to extraordinary lengths, and I guess I love to keep tweaking!