Version 15 (modified by bjorn, 4 years ago) (diff)



Installing Varnish from source code


The following tools are required to build Varnish:

  • A recent version of  GCC (3.3.x or newer should be fine, 4.2.1 or newer recommended)
  • A POSIX-compatible make (GNU make is fine)
  • Recent versions of the GNU autotools ( automake,  autoconf,  libtool and  ncurses)
  • When building source code checked out from the repository (as opposed to source code from a release tarball), you will also need  xsltproc from  libxslt.

Obtaining the source code

 Download varnish. If you need source directly from the source repository please see Repository?. The directory you most likely want to check out is trunk/varnish-cache.

OS specific prerequisites

Various Linux distributions

Mac OS X

  1. Install automake, i.e. via  Darwin Ports: sudo port install automake as the version of automake that ships with OS X is too old.
  1. Make sure /opt/local/bin/automake is in your PATH when running
$ PATH=/opt/local/bin/automake:$PATH ./




  1. Make sure your ports tree is up to date, or you may run into trouble with the GNU autotools.
  1. Install  devel/automake19 (or newer) from the ports collection. This will automatically pull in an appropriate version of autoconf.
  1. Install  devel/libtool15 (or newer) from the ports collection.
  1. Optionally install  textproc/libxslt from the ports collection if you need xsltproc (see above).

Configuring and building

You will first need to generate the configure script:

$ ./

You may see some error messages. Check if configure and were generated. If they weren't, you probably need newer versions of the GNU autotools. If they were; run again: any error messages it still shows the second time around are most likely caused by bugs in autoconf macros installed by other software you have on your machine, and can safely be ignored.

Next, run configure. In most cases, the defaults are correct and you do not need to specify any command-line options, except perhaps --prefix. If you plan on hacking the Varnish sources, however, you will most likely want to turn on stricter error checks and dependency tracking:

$ ./configure --enable-debugging-symbols --enable-developer-warnings --enable-dependency-tracking

If you have gcc 4.2.0 or newer, add --enable-extra-warnings to get additional compile-time warnings.

If you have a version of gcc with stack protection, add --enable-stack-protector to enable run-time stack smashing detection.

If you're trying to track down an elusive bug or a race condition, --enable-diagnostics may help, but it will reduce performance and increase the amount of log data generated.

If configure completes without any errors, simply run make to compile Varnish and make install to install it. You can also run make check to test your build.