What's new? | Help | Directory | Sign in
Google
macvim
Vim for the Mac
  
  
  
    
Search
for
Updated Jun 23, 2008 by bjorn.winckler
Labels: Featured, Phase-Implementation
Building  
How to build MacVim

Building MacVim from the Git repository

Summary

If you know what you are doing, then this should be enough to get you going:

Make sure you pass --enable-gui=macvim to configure, else everything will build but no windows open when you run the application.

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:

More detailed instructions can be found here.

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:

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):

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

Building MacVim from the Subversion repository

The subversion repository has been deprecated, please use Git to download and build MacVim.


Comment by m...@kotka.de, May 27, 2008

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

Comment by timcharper, Jun 29, 2008

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/


Sign in to add a comment