From Vim Tips Wiki
This tip presents an overview of how to download the source for Vim, then build a Vim executable, and install it on your system. You need to download the C source code and the runtime files (standard plugins, help files, and more). You may also need to download dependencies (packages required for building), and you will need a compiler/linker (free versions are available for almost all systems). See where to download Vim if you want to download the Vim program to run on your system, without building it yourself.
 Any platform
It is easy to build Vim from the source code. In general, it takes four steps:
- Get dependencies. On Unix-like systems,
apt-get build-dep vim-gnomeor similar can do this for you. On Windows, there are no dependencies, unless you want to build Vim to use an external DLL for Lua, Perl, Python, Ruby, or Scheme (and you can install these later).
apt-getis for Debian, Ubuntu and similar distributions. On other distributions, the corresponding program may be called
yum, yast, zypper,or otherwise, and the way to invoke it may vary widely. It is usually the same program as the one used on your distro to install, update, or uninstall any software package, and if you are lucky, there may be a manpage for it.
- Get the Vim source code from Mercurial or a GitHub clone.
- Change to the directory with the Vim source code and run "make".
- Do a "make install" or manually copy necessary files to somewhere Vim knows to use. See :help $VIMRUNTIME for details and our tip on manually locating your Vim files.
 Building Vim on Ubuntu
You need the required development packages on Ubuntu to build the GUI:
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \ libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \ libcairo2-dev libx11-dev libxpm-dev libxt-dev
For ruby support, you need for package ruby-dev:
sudo apt-get install ruby-dev
Commands to build and install GUI Vim:
$ cd vim7 $ cd src $ make distclean $ ./configure --with-features=huge --enable-gui=gnome2 $ make $ sudo make install
 Building Vim .debs on Ubuntu/Debian
Commands to get started and build the first time.
$ sudo apt-get install mercurial libssl-dev $ sudo apt-get build-dep vim $ hg clone http://hg.debian.org/hg/pkg-vim/vim $ cd vim $ hg checkout unstable $ debian/rules update-orig $ dpkg-buildpackage -i -I $ cd ..
And to update Vim .debs
$ cd vim $ hg pull $ hg update $ debian/rules update-orig $ dpkg-buildpackage -i -I $ cd ..
 Building Vim on Windows
There are a couple options for a compiler on Windows. Vim ships with makefiles for Cygwin, MinGW, and Visual Studio. Visual Studio express is free to download and use from Microsoft and should work with the supplied makefile.
In general, you will invoke a make program and pass in the desired build options, like:
make FEATURES=HUGE GUI=yes gvim.exe
Some more details and examples here:
- Build Vim in Windows with Cygwin
- Build Vim in Windows with Visual Studio
- Build Python-enabled Vim on Windows with MinGW
After you've built Vim, run the compiled executable and do
:version to verify it built as you intended. Then you're ready to install; close the Vim instance before you continue.
One option is to just install manually every time without any nice installer options like having .bat files in your system path to launch Vim from the command line, a default _vimrc, shell context-menu "Edit with Vim" item, etc.:
But most of the time you want to install Vim somewhere everybody on the computer can use it, and integrate it as if you installed from Bram's binary.
To do this, see the details in the INSTALLpc.txt file in the src directory of the code you downloaded. Basically it all boils down to:
- Create a directory like
- Copy all .exe files from src (which you compiled) to that
- Copy xxd.exe from src/xxd into
- Copy the .dll file from src/GvimExt into
- Copy all files and folders from the runtime directory in your downloaded source into that
- Run a cmd.exe prompt as administrator (i.e. right-click and choose "run as administrator" to give yourself admin rights in UAC).
- Go to the
vim74directory and run the install.exe file you copied over in step (2).
This will put Vim into a spot everybody can use it, and give you options to create default _vimrc, user config areas, .bat files for command-line use, "edit with Vim" context menu, etc.
In Vim, the command
:version includes "Compiled by user@host" (the user and computer host names are provided by the operating system).
The configuration option
--with-compiledby can be used to set the exact "Compiled by" text (for example, to include an email address).
 Using patches
- Following works but is obsolete; see above for information on using Mercurial.
- The following applies to Unix-based systems, and Windows.
Download the source from
Download the extras from
Expand each in the same directory, for example
Download the patches from
Apply the patches.
Build (compile and link).
 See also
Tips, some of which need updating
- Building vim with color on HP-UX
- Compile a separate copy of Vim for Python coding
- Getting the Vim source with Mercurial
- Get latest releases for syntax highlighting, runtime, plugins etc
- Category of tips for building Vim
External sites with how-to information on building Vim
- Where to get other stuff included in the standard installation, like
Merge or link to some of these?
- 636 Adding Vim to MS-Windows File Explorer Menu
- 861 Right click in Windows Explorer to open gvim in explorer mode
- 1003 Windows file associations
- 1225 Open files in multiple tabs using the Windows Context Menu
- 1314 Add open-in-tabs context menu for Windows
- 1542 Vim On Vista (the introductory para)
The only tip with info on diff.exe is:
Make sure the library names are correct for all or most distributions. In the Linux dist I'm using it seems the libraries are named <X>-devel instead of <X>-dev. Michael Greene 15:50 Feb 27, 2011 (UTC)