I require MacVim on OSX to work productively. I also use a couple of plugins that require Python - YouCompleteMe and powerline. After upgrading to Mavericks I was having problems since my brew'd Python was replaced with the OSX system python. It felt like a clean install of MacVim was in order anyway.

I experienced a ton of difficulties getting MacVim compiled with a bunch of false leads and research. I tried using the precompiled Python 2.7.5 installer (which I had to manually uninstall, ick), building MacVim from source with crazy LDFLAGS and CFLAGS settings, and a few other things. Ultimately the best I could end up with was a successful build (this took some herculean effort to attain) that would crash rather anticlimactically:

$ mvim  
Fatal Python error: PyThreadState_Get: no current thread  
...

Great times. Fortunately I got it working and I can be productive once again.

Everything here applies to the Homebrew (brew) installed version of MacVim using the OSX system installation of Python. If you are reading this a few weeks or longer after Mavericks has been released to the public then its likely these problems will have been solved already within Homebrew.

First I had to manually patch /usr/local/Library/Formula/macvim.rb. Around the line that reads:

ENV.prepend 'LDFLAGS' ...
I added:
ENV.prepend 'CFLAGS', "-L#{`python-config --cflags`}"

Then I had to create a custom symlink to get past a build problem:

$ cd /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7  
ln -s . Python

(This corrects a problem where <Python/Python.h> can't be located during compilation.)

I also fixed problems pointed out by running brew doctor which included updating boost and adding missing dependencies for a number of installed formulas. I'm not certain this was essential but it seemed like a good time to sort this out and it only took about 20 minutes (with boost's compilation taking about 15 minutes of that time).

In my ~/.zshenv (or in your case it could be ~/.bashrc or ~/.zshrc or whatever you're setup to use) I needed this magical variable:

export DYLD_FORCE_FLAT_NAMESPACE=1

Don't forget to source ~/.zshrc (or whatever) when you make that change.

Finally:

$ brew install --verbose  macvim --env-std --override-system-vim --python

I use --verbose here to catch whether I get the dreaded checking if compile and link flags for Python are sane... no: PYTHON DISABLED output; I saw this a lot while I was working my way through this problem.