|
|
Building MacVim from the Git repository
Summary
If you know what you are doing, then this should be enough to get you going:
- Clone the MacVim.git repo: git clone git://repo.or.cz/MacVim.git vim7
- Configure and build Vim: cd vim7/src; ./configure --enable-gui=macvim; make
- Build MacVim.app: cd MacVim; xcodebuild
- Run: open build/Release/MacVim.app
Downloading and building
To get the source code you need Git, see below for installation instructions if you have not installed Git already. (Note that it is possible to get the source code without installing Git but it will be much easier to keep your local copy of the source code up to date once you have installed Git. See the comment at the end of this page on how to download the source code without using Git.)
Once you have Git installed you first have to clone the MacVim.git repo
localhost:~ user$ git clone git://repo.or.cz/MacVim.git vim7
This will create a folder named vim7 and populate it with all the source code needed to build MacVim (you can choose any name you want instead of vim7).
Next, you have to configure Vim to include the MacVim specific code and build Vim
localhost:~ user$ cd vim7/src localhost:~/vim7/src user$ ./configure --enable-gui=macvim localhost:~/vim7/src user$ make
Be very careful when typing that second line! If you misspell the parameters to configure then everything will compile but MacVim won't open any windows when you start it. After make finishes you should have a binary named Vim in the vim7/src folder.
Optional: If you want to build MacVim with custom features, then you need to pass the appropriate flag to the configure script. To see what options are available, type ./configure --help (ensure that the working directory is ~/vim7/src first). For example, to compile MacVim with Perl support substitute the second line above with ./configure --enable-gui=macvim --enable-perlinterp.
The final step is to build the MacVim application.
localhost:~/vim7/src user$ cd MacVim localhost:~/vim7/src/MacVim user$ xcodebuild
That's it! MacVim.app is in the build/Release folder, try to run it by typing
localhost:~/vim7/src/MacVim user$ open build/Release/MacVim.app
Updating an existing Git repository
If you already have the MacVim.git repo then updating it is as easy as
localhost:~ user$ cd vim7 localhost:~/vim7 user$ git pull
Contributing with patches
See the wiki page on Contributing.
Installing Git
If you already have MacPorts installed, then you can install Git by opening a Terminal window and typing
localhost:~ user$ sudo port install git-core +svn
(The +svn flag is not strictly necessary, but if you might ever need to use the git-svn command in the future it is best to include it.)
If you do not already have MacPorts installed, be warned that installing both MacPorts and Git will take a long time. A faster alternative is to install Git directly from the sources, but it requires that you know what you are doing.
To install Git from the source code archive:
- download the latest Git source code archive from http://git.or.cz
- if you are compiling on Mac OS X 10.4, then you also need to download the Expat library (skip this step if you are running Mac OS X 10.5)
- make and install Expat (skip this step if you are running Mac OS X 10.5)
- make and install Git (gotcha: it is not possible to build the documentation without installing additional libraries first; check the INSTALL file that comes with the Git source code)
- (if Git fails to build complaining about something to do with gettext then you should download and install gettext and then try building Git again)
As an optional extra you might want to configure the git-svn command (this is not necessary if you only want to compile MacVim). To do this, follow these optional steps:
- download and install Subversion
- add the line export PERL5LIB="/opt/subversion/lib/svn-perl" to ~/.profile so that git-svn can find the Perl bindings to Subversion
Running several versions of MacVim simultaneously
If you have one version of MacVim in e.g. /Applications and then build another with Xcode and try to run it, there will be trouble (since both are listening to the same named port for new Vim connections). To get around this do the following (assuming you have installed MacVim in the Applications folder):
- Open a Finder window on /Applications
- Rename MacVim to MacVim-devel
- Ctrl-click on the MacVim-devel icon and choose 'Show Package Contents'
- In the window that opens, double-click on Contents and then on Info.plist; this will bring up the 'Property List Editor'
- Expand Root, change CFBundleIdentifier to org.vim.MacVim-devel; save and quit the 'Property List Editor'
You can now run MacVim-devel whilst building and running MacVim in Xcode.
Alternatively, if you can leave the version in /Applications alone (say, if this is the snapshot build) and modify the CFBundleIdentifier of the version you are building instead. To do this, open the file Info.plist inside the src/MacVim folder and change the value of CFBundleIdentifier (e.g. add -devel to the end). Each time MacVim is built it will copy Info.plist to the app bundle so that your custom built MacVim will have a different CFBundleIdentifier from the version inside /Applications.
Building a universal binary
By default only a native binary will be built. To build a universal binary you must first pass --with-mac-arch=both to configure and then use the 'Universal' build configuration when building MacVim.app in Xcode.
Using only Terminal, do the following (assuming you've checked out the source code into the folder ~/vim7):
localhost:~/vim7/src user$ ./configure --enable-gui=macvim --with-mac-arch=both localhost:~/vim7/src user$ make clean && make localhost:~/vim7/src user$ cd MacVim localhost:~/vim7/src/MacVim user$ xcodebuild -configuration Universal clean localhost:~/vim7/src/MacVim user$ xcodebuild -configuration Universal
The app bundle can be found in the folder ~/vim7/src/MacVim/build/Universal.
Random notes
- At the moment the Vim runtime files are not updated inside the app bundle if they are modified. If you modify any runtime files, then you have to clean the MacVim project and build it again.
- To build with Ruby support on OS X 10.4 (Tiger), you may get an error from configure saying that the Ruby header files cannot be found. If you run into this problem, open up Terminal and type
cd /usr/lib/ruby/1.8/powerpc-darwin8.0 sudo ln -s ../universal-darwin8.0/*.h ./
Building MacVim from the Subversion repository
The subversion repository has been deprecated, please use Git to download and build MacVim.
Sign in to add a comment

Please note, that it is not necessary to install git! Go to the Git repository. Pick the desired changeset in the list and use the "snapshot" link to download a tar.gz. Extract the tar.gz and go on with building MacVim?. -- mb
Leopard Intel Installers for Git can be found over here, if you don't want to compile them:
http://code.google.com/p/git-osx-installer/
build errors
I got build errors right after a git clone, barfing about not finding some osdefs.shind src/auto.
Google yields http://www.nabble.com/Re:-Problems-compiling-vim-with---enable-gui-on-Debian-4.0-td16786854.html
The scoop is that a
Is sometimes needed.