I recently made a clean install of my Mac, including MacVim and Command-T.
This didn't go quite as expected on my clean Mavericks Mac, and as I've been unable to find the fix anywhere (And the crash reported make little sense unless you have experienced this before), I figured I might as well provide the fix I just made on my setup.
The challenge with Command-T on Mavericks
Command-T is great, but it requires compilation of a few dependencies, in which the ruby version used for running this, must match the version vim/MacVim uses (this is mentioned on https://github.com/wincent/Command-T ).
In previous versions of Mac OS X, Apple used Ruby 1.8.7 per default as the system Ruby. The vim/MacVim community has made use of this fact, as it basically just required MacVim to be linked to the same version, to enable easy building of Command-T.
However, in Mavericks, the default Ruby is now 2.0.0p247 (you can check this by running ruby --version
), which means that the default Ruby and the one MacVim (And the system vim) is built towards, is not the same.
Now, according to the official Command-T docs, apart from installing the bundle, you must build the Ruby extension like this:
cd ~/.vim/bundle/command-t/ruby/command-t
ruby extconf.rb
make
But if this is done using the system Ruby, the version will not be the same as vim/MacVim uses, causing vim/MacVim to crash by throwing the following message:
Vim: Caught deadly signal TRAP
Vim: Finished
As mentioned previously - not exactly a precise error message. But I just happen to know this is caused by the Ruby versions diverging.
Have no fear - debugging is here!
The main concern now, is the fact that apparently vim uses Ruby 1.8.7, and this is not available, as the system Ruby used by Apple is 2.0.0. However, the "old" Ruby versions are actually available to Mac OS, you just need to know where to look.
Figuring out the Ruby version vim uses
First up, to figure out the location of Ruby 1.8.7, I used MacVim - regular vim might be able to do the same. Anyway, by calling mvim --version
, I get the details of the compilation, ending like this:
Compilation: cc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X_UNIX -no-cpp-precomp -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -I/System/Library/Frameworks/Tcl.framework/Headers -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_DARWIN_C_SOURCE=1
Linking: cc -L. -L. -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon -lm -lncurses -liconv -framework Cocoa -fstack-protector -L/usr/local/lib -L/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE -lperl -framework Python -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation /System/Library/Frameworks/Ruby.framework/Versions/1.8/Ruby
Now, the end of the string tells me that OS X stores different Ruby versions in /System/Library/Frameworks/Ruby.framework
. So, by looking through /System/Library/Frameworks/Ruby.framework/Versions/1.8
, I quickly figure out that /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
is the 1.8.7 ruby executable I am looking for.
Compiling using the correct Ruby
Now that the correct version of Ruby is located, it's simply a matter of using the correct Ruby executable when compiling. So, instead of the initial instructions from Command-T, do like this:
cd ~/.vim/bundle/command-t/ruby/command-t
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
make
And voilá! Vim works with Command-T