-
-
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
- Scripting support
- Python interpreter:
--enable-python3interp
- Ruby interpreter:
--enable-rubyinterp
- Perl interpreter:
--enable-perlinterp
- 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
- Python interpreter:
- Universal binary:
--with-macarchs=ARCHS
(ARCHS
examples:x86_64
,arm64
,…. To build universal binary, separate the different values with space, e.g.--with-macarchs="x86_64 arm64"
) - macOS SDK version:
--with-macsdk=$VER
($VER
examples: 10.15,13.0,…) - macOS deployment target (the minimum macOS version that can run this): Instead of a configure flag, set environment variable
MACOSX_DEPLOYMENT_TARGET=$VER
when runningconfigure
andmake
($VER
examples: 10.15, 13.0, …).- Example (targeting 10.13):
MACOSX_DEPLOYMENT_TARGET=10.13 ./configure; MACOSX_DEPLOYMENT_TARGET=10.13 make
.
- Example (targeting 10.13):
-
Sparkle (this is the software updater MacVim uses to keep itself up to date):
- Disable Sparkle:
--disable-sparkle
- Use Sparkle 1. By default MacVim uses Sparkle 2, which has higher OS requirements than Sparkle 1.
- First, change the
Sparkle.framework
symlink:ln -fsh Sparkle_1.framework src/MacVim/Sparkle.framework
- Run configure with
--enable-sparkle-1
- First, change the
- Disable Sparkle:
- Optional libraries
- Enable/Disable gettext (localization). It should be enabled by default (if gettext exists):
--enable-nls
/--disable-nls
- Enable/Disable sodium (encryption support). It should be enabled by default (if sodium exists):
--enable-libsodium
/--disable-libsodium
- Use Homebrew libraries (e.g. gettext/libsodium) on Apple Silicon:
--with-local-dir=/opt/homebrew
- Enable/Disable gettext (localization). It should be enabled by default (if gettext exists):
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.