I was pulling my hair to get my vim setup with YouCompleteMe on my macbook after I upgraded to Yosemite. On Mavericks it was pretty straight forward. The following used to work -
# install xcode and command line tools
$ xcode-select --install
# install homebrew
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install python
$ brew install python
# install macvim
$ brew install macvim
Now following instructions on the Vundle Github
page to setup Vundle.
Add the reference to YouCompleteMe plugin in your .vimrc file along
with other plugins you use. Here is what mine looks like -
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'altercation/vim-colors-solarized'
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/syntastic'
Plugin 'Valloric/YouCompleteMe'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
Now Install all plugins including YouCompleteMe using Vundle by launching vim and executing :PluginInstall
Complete YCM install by running the following from within the YCM vim bundle -
$ cd ~/.vim/bundle/YouCompleteMe
$ ./install.sh --clang-completer
Now after doing the above on Yosemite, everytime I opened vi, I would get a python crashed error message pop up.
After looking around for a fix, this
post gave me
the right direction.
I first have to make sure I have the file -
/Library/Developer/CommandLineTools/usr/lib/libclang.dylib
If the above file is missing, that means command line tools has not been
installed.
Run “xcode-select —install” and follow the prompts to install command
line tools.
I exported the variable EXTRA_CMAKE_ARGS on terminal -
EXTRA_CMAKE_ARGS="-DEXTERNAL_LIBCLANG_PATH=/Library/Developer/CommandLineTools/usr/lib/libclang.dylib"
Then in the same terminal session running the following -
$ cd ~/.vim/bundle/YouCompleteMe
$ ./install.sh --clang-completer --system-libclang
That did the trick. MacVim with YouCompleteMe should now be working. CodeCompletion on vim could not get any better :)