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:
1
| LDFLAGS = -L. -arch i386 -arch x86_64 |
To look like:
1
| 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:
1
| ~ $ git clone git://repo.or.cz/MacVim.git |
Then change into the MacVim/src directory and configure and run make:
1 2 3
| ~ $ cd MacVim/src
MacVim/src $ ./configure --enable-gui-macvim --enable-rubyinterp
MacVim/src $ make |
Now change into the MacVim directory:
Normally this is where you would run xcodebuild, however that resulted in the following:
1 2 3 4 5
| ** 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:
1 2 3
| 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:
to:
Change back to the MacVim directory and run xcodebuild:
1 2
| MacVim/src/MacVim/icons $ cd ..
MacVim/src/MacVim $ xcodebuild |
You should now see something like the following:
1 2
| PyObjC not found, only using a stock icon for document icons.
** BUILD SUCCEEDED ** |
Now move the MacVim.app to the /Applications folder:
1
| 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:
1
| 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