-
-
Notifications
You must be signed in to change notification settings - Fork 683
Building
For installing MacVim, it's recommended to use the official binary releases. See Installing. Below are instructions for building MacVim if you would like to modify it.
Open up Terminal and type (this requires that you have Git installed):
$ git clone https://github.com/macvim-dev/macvim.git
(If you do not have Git installed the "Zip" button under the "Code" tab lets you download an archive containing the source code.)
First clone the repo as above, then configure
with the flags you want, e.g.:
$ cd macvim/src
$ ./configure --enable-rubyinterp \
--enable-python3interp \
--enable-perlinterp \
--enable-cscope
Note: On Mac OS X versions where gcc
is not an alias for clang
(such as 10.7 or 10.8) you must set the environment variable CC=clang
before calling configure
, e.g. type CC=clang ./configure
and then add any flags to configure
. If you want to build with clang
on earlier platforms then you have to switch vim/MacVim/MacVim.xcodeproj
to clang too, else IPC between backend and GUI won't work.
Once this has finished, build the project:
$ make
The resulting app bundle will reside under MacVim/build/Release
. To try it out quickly, type:
$ open MacVim/build/Release/MacVim.app
To open the terminal version of MacVim, type:
$ MacVim/build/Release/MacVim.app/Contents/bin/vim
To install MacVim, type
$ open MacVim/build/Release
and drag the MacVim icon into your Applications
folder.
You can enable extra Vim features by passing the appropriate flags to configure
. You don't really need to turn on any flags unless there are specific features you want. These are the parameters to configure
you may want to enable:
- All standard features (this is turned on by default and only for reference):
--with-features=huge
- Cscope support:
--enable-cscope
- Python interpreter:
--enable-python3interp
- Ruby interpreter:
--enable-rubyinterp
- Perl interpreter:
--enable-perlinterp
- Universal binary:
--with-macarchs=ARCHS
(ARCHS
examples:x86_64
,arm64
,…. The one or more items have to be separated by spaces) - Mac OS X SDK version:
--with-macsdk=VER
(VER
examples: 10.4,10.5,10.6,…) - Disable Sparkle (auto-updater):
--disable-sparkle
- Allow both Python 2 and 3 scripts to be run (see https://github.com/macvim-dev/macvim/wiki/Python-2.x-and-Python-3.x/):
--with-properly-linked-python2-python3
To see all available flags, type ./configure --help
.
Easiest way to clean all configured results is by using make distclean
which will remove all built binary and configuration and you can call configure
again from a clean slate.
If you would like to debug MacVim using Xcode, you first have to build Vim using make
(see above). After you build the Vim binary, open src/MacVim/MacVim.xcodeproj
and you can build, run, and debug MacVim code from within Xcode. See this document for more info of how the code is structured.
If you would like to debug the Vim process instead (MacVim hosts each window in a separate Vim process and talks to them via Distributed Objects), do the following for best results:
- Build using
make "CFLAGS=-O0 -g" XCODEFLAGS="-configuration Debug"
to build Vim without optimizations, and to build a debug Xcode build. - Turn off QuickStart in Advanced Preferences. When that option is on there is a shadow Vim process which makes it more annoying to figure out one is the one you want to debug.
- Run MacVim from Xcode, wait for the Vim window to show up.
- Find out the PID of the Vim process by running the following in the MacVim source folder:
ps aux | grep "`pwd`.*/Contents/MacOS/Vim" | grep -v grep
. The first number you see is the PID. - In Xcode (it should already be debugging MacVim itself), select Debug → Attach to Process by PID or Name, and paste in the PID of Vim.
- Xcode should now be able to debug and set breakpoints within the Vim process.