Getting Vim up and running under Snow Leopard

So, last night I upgraded my dev machine to Snow Leopard and what kind of a dev machine would it be without Vim?
Fortunately, for some at least, OS X still ships with Vim precompiled, unfortunately for me tough it still don’t come with ruby support enabled.

Since MacVim, which I usually use, isn’t yet compatible with Snow Leopard I decided to try and compile the regular vim as Mathias explained in a previous blog post about compiling for leopard, well that attempt crashed and burned. I did however get it to compile correctly after a minor tweak to his instructions:

On line 7 in src/auto/config.mk I changed the following line:
LDFLAGS = -L. -arch i386 -arch x86_64

To look like:
LDFLAGS = -L. -arch x86_64

While it did compile successfully, launching Vim just resulted in it exiting immediately with the message: abort trap.

Back at square one I started browsing the vim_mac mailing list and here’s how I finally got it working:

Start off by cloning the macvim repository:
~ $ git clone git://repo.or.cz/MacVim.git

Then change into the MacVim/src directory and configure and run make:
~ $ cd MacVim/src
MacVim/src $ ./configure --enable-gui-macvim --enable-rubyinterp
MacVim/src $ make

Now change into the MacVim directory:
MacVim/src $ cd MacVim

Normally this is where you would run xcodebuild, however that resulted in the following:
** BUILD FAILED **
The following build commands failed:
MacVim:
PhaseScriptExecution "Make Document Icons" /Users/pmh/Downloads/MacVim/src/MacVim/build/MacVim.build/Release/MacVim.build/Script-1D1C31F00EFFBFD6003FE9A5.sh
(1 failure)

The way to get around this is a bit cumbersome, but works.

Start by deleting line 6 in the Makefile that lives under the icons directory:
MacVim/src/MacVim $ cd icons
MacVim/src/MacVim/icons $ vim Makefile
# delete line 6 and save

Then change line 22 in make_icons.py, in the same directory, from:
dont_create = False
to:
dont_create = True

Change back to the MacVim directory and run xcodebuild:
MacVim/src/MacVim/icons $ cd ..
MacVim/src/MacVim $ xcodebuild

You should now see something like the following:
PyObjC not found, only using a stock icon for document icons.
** BUILD SUCCEEDED **

Now move the MacVim.app to the /Applications folder:
MacVim/src/MacVim $ mv build/Release/MacVim.app /Applications/

In order to invoke vim from the command line you need to add the following alias to your ~/.profile or what have you:
alias vim=/Applications/MacVim.app/Contents/MacOS/Vim

Note however that this only lets you use the command line version of MacVim, there seems to still be some issues with the graphical one.

Update:
As Björn pointed out in the comments, the graphical version of MacVim does work under Snow Leopard, also be sure to checkout his precompiled binary

Posted in Mouseless, Operatingsystem, Utilities at September 1st, 2009. Trackback URI: trackback Tags: , , Written by: Patrik Hedman

2 Responses to “Getting Vim up and running under Snow Leopard”

A quick correction: MacVim _does_ run in GUI mode on Snow Leopard — the only current problem is the icon generation. I’ve also linked to a prebuilt binary on my blog.

BjörnNo Gravatar on September 4th, 2009 at 2:19 pm

Your absolutely right, I must have done something wrong before :) Thanks for the precompiled binary, I will definitely check that out.

pollyNo Gravatar on September 6th, 2009 at 1:10 pm

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

pastbedti.me is using WP-Gravatar