Installing MacVim with Ruby support and Command T on OSX Lion

When I set up my new Macbook Air recently, I ran into some unexpected problems setting up MacVim – mostly related to Ruby versions linked against MacVim and the Command T plugin. Here are some notes that might help you.

Note
In case you wonder: MacVim uses it own separate version of vim (installed here: /Applications/MacVim.app/Contents/MacOS/Vim), which is not linked against your own /user/local/bin/vim (or wherever your vim resides), which you or your package manager installed separately. The reason I’m mentioning this is that if you lack Ruby support in MacVim, compiling vim by hand won’t help, since MacVim doesn’t use it.

Howto

in my case:
$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.1]

$ brew install macvim

* start MacVim with
$ mvim
run :version and make sure it lists +ruby (instead of -ruby)
test Ruby support by invoking
:ruby nil[]
which should return a NoMethodError

 

$ cd ~/.vim
$ git submodule add git://git.wincent.com/command-t.git bundle/command-t
$ git submodule init
$ git clone git://git.wincent.com/command-t.git bundle/command-t

$ cd ~/.vim/bundle/command-t
$ rake make

more details in section 4 “MANAGING USING PATHOGEN” of: https://github.com/wincent/Command-T/blob/master/doc/command-t.txt

  • create a symlink under Applications:
    $ ln -s /usr/local/Cellar/macvim/7.3-62/MacVim.app /Applications/MacVim.app 

    Troubleshooting

    1) Lacking Ruby support inside MacVim
    Symptom: Plugins written in Ruby, like Command T or Lusty Juggler, don’t work.
    Check: $ mvim –version or :version inside of MacVim should list “-ruby”, if your version lacks Ruby support (“+ruby” if it has Ruby support built in).
    Cause: This happens when your version of MacVim was compiled without the –enable-rubinterp flag. This usually happens when you install a binary off MacVim’s Google Code Project.
    Remedy: Best use Homebrew to install MacVim from source. Although the Homebrew command’s output does not explicitly list the –enable-rubyinterp flag, you should be fine and :version should list +ruby.

    2) Can’t compile MacVim or vim
    Cause: You probably didn’t install Xcode. Unfortunately you need proprietary Cocoa headers for MacVim, which are not included in this Kenneth Reitz’ GCC OSX installer (https://github.com/kennethreitz/osx-gcc-installer; cf. related problem: https://github.com/mxcl/homebrew/issues/7576).
    Remedy: Install the full Xcode package via Apple’s App Store. Make sure to check your Launchpad for download activity – it took me half an hour to figure out that the app store’s Install button was actually doing something and not broken.

    3) Command T complains about lacking C extensions
    Symptom: Command T doesn’t start and informs me about missing C extensions.
    Remedy: run rake make inside ~/.vim/bundle/command-t

    4) Command T causes SIGTERMS
    Symptom: After having compiled Command T’s C extensions, as soon as you try to invoke Command T inside MacVim, it causes the program to crash with a SIGTERM exception.
    Cause: Usually the reason for the SIGTERM is that your MacVim was compiled with a link to a different version of Ruby than Command T. However, I encountered the same problem when linking everything against system Ruby (1.8.7 in my case).
    Remedy: Be very careful about your RVM/rbenv settings and ensure the exact same version of Ruby is active when you compile MacVim (installing via Homebrew triggers a compilation process) or Command T. My issue was resolved by using Ruby 1.9.2 instead of system Ruby.

  • Resources

    Ruby & Rails UG meetup: 24 Mar @ CoWoCo

    We’re very excited to announce the second meetup of the revived Cologne Ruby & Rails User Group RuRUG!

    RuRUG

    To take part in the awesomeness that is meeting your local gang of fellow Ruby & Rails aficionados, pop by Coworking Cologne on Thursday, 24 March at 20:00.

    The schedule so far consists of a JRuby on Rails talk by Jan Lühr. More slots are still up for grabs – feel free to suggest your own talk, or boldly give an impromptu presentation of anything you’re interested in. After the presentations, there’ll be plenty of time to meet new people, do some collaborative hacking and have a couple of beers =)

    Hope to see you there!

    For directions and further information, make sure to check out RuRUG’s website, mailing list, and facebook page.

    Railslove’s Latest: Flört my Number FB App

    We just released our latest app – Flört my Number – in collaboration with Wunderknaben Communications and Das Örtliche, Germany’s phone directory.

    Flört my Number is a Facebook app that simulates “a harmless flirt” with the help of interactive video clips – German only, I’m afraid. You can choose whether to flirt with Laura or Ben and try your best to get their number. If you’re fast enough you might make it on the high score list and win an iPhone, Wii or TUI travel coupons – good luck & happy flörting!

    Thanks and props to Lena, Dennis, Ecki, Bumi, Lars, Tim, and Paul for coding!

    floert