How do I compile vim with the --enable-gui=yes flag on OS X 10.8.2
I'm trying to compile the latest version of vim
(7.3.785 as on date) with the --enable-gui
option set to yes
:
./configure --enable-gui=yes
make
but make
fails with several errors (full output). I can't quite make sense of the errors, as I don't see anything specific that I can fix. I must add that compiling it works fine without the GUI option, so it might be something directly related to X or the OS X Cocoa frame work. I'm running OS X 10.8.2 on a retina MBP.
What should I change/add/install to get this to work?
Note: This question is explicitly about compiling
vim
from source with the GUI option. I'm aware ofmacvim
and this is what I use for almost everything. However, in order to embedvim
inside Eclipse usingeclim
, I needgvim
(works out of the box on Windows and Linux). Unfortunately,macvim
does not support embedding inside Eclipse, hence my attempts to make it work on OS X.
Solution 1:
You can fix the error about missing header files by exporting CFLAGS like this before running make
:
export CFLAGS="-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/Headers/FlatCarbon/"
Unfortunately, a new attempt to compile vim
fails with loads of errors:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/MacTypes.h:17:24: error: #include nested too deeply
(...)
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:156: error: conflicting types for ‘Boolean’
/usr/X11/include/X11/Intrinsic.h:155: error: previous declaration of ‘Boolean’ was here
(...)
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/MacTypes.h:11:20: error: missing binary operator before token "("
(...)
and README_mac.txt doesn't offer much help:
(...)
Sorry, this text still needs to be written!
After some more failed attempts with other compile options, and after skimming through the errors, one quickly gets the impression that GUI support is not yet implemented for OS X, at least for Quartz.
A look to the other options for getting vim
, HomeBrew and MacPorts, pretty much confirms the suspicion: The former doesn't offer GUI support at all (see here) and the latter only using X11 (see here).
So to compile vim
with GUI support you will have to revert to the good ol' X11 (I tested the Athena widgets, other options are motif
and, if you use GTK, gtk1
and gtk2
):
$ make distclean
$ ./configure --enable-gui=yes --enable-gui=athena --disable-darwin
After launching XQuartz I could start vim
in GUI mode:
$ export DISPLAY=:0
$ ./src/vim -g
However, I have the impression that this is not the GUI support you need to embed vim
inside Eclipse.
Solution 2:
You can use macports to install vim
with gtk support:
sudo /opt/local/bin/port install vim +huge +gtk2