Skip to main content
Enterprise Agile Planning Image

This post is from the CollabNet VersionOne blog and has not been updated since the original publish date.

Last Updated May 19, 2009 — Enterprise Agile Planning expert

Building an OS X based Subversion Server

Enterprise Agile Planning


This article explains in-depth how to build a Subversion server on OS X.  While building a Subversion server is the purpose of this article, a lot of the information you learn is operating system agnostic. So, whether you're building a Linux-based Subversion server or a Windows-based Subversion server, a lot of the same rules and procedures will apply. That being said, let's get started.


The first order of business is to install Subversion.  As of OS X 10.5 (Leopard), Subversion is shipped with the core operating system.  Whether you are looking to upgrade the 1.4.4 version installed with Leopard or you need to install for Tiger, there is a full-featured Subversion binary for  OS X offered on openCollabNet.  We just released the Subversion 1.6.2 binary last week.  If you're new to the binary, let me tell you a few of its most important features:
  • The binary provides a complete Subversion installation
  • The Subversion installation is a 4-way universal binary (i386, ppc, x86_64 and ppc64) 
  • Works on any version of OS X, 10.4.x+
  • Includes the Apache modules and svnserve built with SASL support
  • Includes both repository data stores (Berkeley DB and FSFS) 
  • Includes the Subversion language bindings maintained by the Subversion team (Java, Perl, Python and Ruby)
  • Packaged in an easy-to-use graphical installer package
  • Completely isolated and does not interfere with any other installed Subversion binary 

As you can see, this binary is quite complete and being packaged in an installer makes the installation simple.  How simple?  Just download, open the .dmg file, double-click the .pkg and follow the instructions.  The only thing left is to make the newly-installed Subversion the default Subversion by updating your PATH environment variable.  This can be done a multitude of ways and differs based on the terminal you use but if you're using the default, you can append the following to your /etc/profile file:

export PATH=/opt/subversion/bin:$PATH

Once you've done this, you should be able to launch, run "svn –version" and see the information from your new Subversion installation.  Now that we've got Subversion installed, let's go ahead and create a few Subversion repositories so we can serve them from our new Apache-based Subversion server.

Creating repositories

Since we plan on serving multiple Subversion repositories, let's create a container directory for those repositories.  To do this, run the following:

sudo mkdir -p /opt/repos/svn

Once you have the container directory created, you can then create your repositories using the "svnadmin create" Subversion command like so:

sudo svnadmin create /opt/repos/svn/test

Change the path and repository as needed and then repeat the process until you have all of your repositories ready.  If you already have repository you'd like to serve, just move them to your new repositories container.

Setting up the Server

Most of the time when people setup Subversion servers, the first problems they run into is related to file system permissions.  Whether you use Apache or svnserve, your file system permissions need to be so that the user that Apache or svnserve run under has the proper permissions to access the repository file system structure, since Subversion repositories are nothing more than a directory structure.  For this example, we'll be running Apache and we need to fix the permissions so that the default Apache user and group can read/write the file system.  To do that, run the following:

sudo chown -R www:www /opt/repos/svn

Now that we have the file system permissions fixed, we can setup Apache to serve our repositories.  Below is a very simple example of how you might do that.  If you want a more in-depth example, please review my earlier blog entry titled "Subversion with Apache and LDAP".

# Load Subversion Apache Modules
LoadModule dav_svn_module /opt/subversion/lib/svn-apache/

# Work around authz and SVNListParentPath issue
RedirectMatch ^(/repos/svn)$ $1/

# Enable Subversion logging
CustomLog logs/svn_logfile "%t %u %{SVN-ACTION}e" env=SVN-ACTION

<Location /repos/svn/>
# Enable Subversion
DAV svn

# Directory containing all repository for this path
SVNParentPath /opt/repos/svn

# List repositories collection
SVNListParentPath On

You can also use the excellent Apache documentation on authentication, authorization and access control.  The only remaining thing let to mention is something I ran into when building a Leopard-based Subversion server on a 64-bit system.  Basically Apache is built and ran as a 64-bit application in Leopard.  When you start up Apache after installing the binary linked to above, you might see an error about missing/undefined symbols.  The reason for this is that Apache on Leopard uses /usr/sbin/envvars when you start up Apache and it is built to set the DYLD_LIBRARY_PATH to pick up libraries from /usr/lib.  Well, since our version of Subversion installs to /opt/subversion, you end up with the Apache modules attempting to use old/missing libraries.  To fix this, just update /usr/sbin/envvars to prepend /opt/subversion/lib to the DYLD_LIBRARY_PATH and you'll be good to go.  (Note: I've been told that this step causes another issue where Apache tries to use the APR shipped with the OS X binary.  To avoid this, make sure both lines, the definition of DYLD_LIBRARY_PATH and the export line, are commented out.)

To test, open and run the following:

sudo apachectl -k start

You can then open your browser to http://localhost/repos/svn and you should see a listing of your repositories.


As you can see, installing Subversion and configuring it for OS X is very simple.  While there are a few things that you need to know to guarantee a smooth installation, for example filesystem permissions and the Apache modules issue, everything else is relatively simple.  I hope this article helps those of you building OS X based Subversion servers.

(Updated on 06/04/2009 to fix a typo and to add a note about /usr/sbin/envvars.)

More from the Blog

View more
Apr 08, 2021

Making IT services more agile

Enterprise Agile Planning
The agile revolution completely transformed how we create digital prod ...
Read More
Feb 14, 2021

Reflecting on the 20th anniversary of the Agile Manifesto

Enterprise Agile Planning
Over the past 20 years, it’s been amazing to watch an idea from ...
Read More
Feb 08, 2021

How does agile apply to an entire organization?

Enterprise Agile Planning
Before we dive into the main subject of this blog post, it is importan ...
Read More
Feb 03, 2021

It took a pandemic to realize why digital transformation actually matters

Enterprise Agile Planning
Before anyone had ever heard of COVID-19, businesses across the globe ...
Read More
Contact Us