Serving svn with httpd on OS X
With the move from Mac OS X 10.7 to OS X 10.8, Apple removed user facing support for the Apache httpd and the svn modules. This article shows how to restore this ability and serve svn over http in Mac OS X.
With the move from Mac OS X 10.7 to OS X 10.8, Apple removed user facing support for the Apache httpd and the Subversion (SVN) modules. This article shows how to restore this ability and serve svn over http in Mac OS X.
Update for OS X 10.9: Serving svn with httpd on OS X 10.9, Mavericks, is now available.
I previously discussed looking for alternative ways to serve svn repositories; alternative methods included serving over ssh and directly with svnserver. Neither method immediately offered what I lost during the Mac OS X update from Lion to Mountain Lion.
Restoring svn Over http
The Apache httpd server is still included in OS X 10.8. The user interface has been removed and so have the httpd modules for svn. To restore svn over http, we are going to need to get those modules back.
Before continuing, be sure to install the latest Xcode and the Command Line Tools. The following instructions require the command line compiler included with these downloads.
Installing the Right Version
The best way to get the modules back is to build them from source.
We need to know what version of svn is installed, so we can download the matching version of the source code. To get the installed svn version, issue the following command in Terminal.app:
You will see output something like:
svnadmin, version 1.6.18 (r1303927) compiled Aug 4 2012, 19:46:53 Copyright (C) 2000-2009 CollabNet. Subversion is open source software, see http://subversion.apache.org/ This product includes software developed by CollabNet (http://www.Collab.Net/). The following repository back-end (FS) modules are available: * fs_fs : Module for working with a plain file (FSFS) repository.
The important part to note is the version 1.6.18 snippet. Knowing this, we can now visit the subversion archive and download Subversion v1.6.18:
Download and Build svn
Download, decompress, and change into the resulting folder with.Terminal.app:
curl 'http://archive.apache.org/dist/subversion/subversion-1.6.18.tar.bz2' > ~/Downloads/subversion-1.6.18.tar.bz2 cd ~/Downloads bunzip2 subversion-1.6.18.tar.bz2 tar -xf subversion-1.6.18.tar cd subversion-1.6.18
From there we will build but not install the subversion source:
With the source code built, we next need to find the Apache httpd modules missing from OS X 10.8 and copy them somewhere reasonable.
Copy the svn Modules
The Apache httpd modules we require are in hidden folders waiting to be installed. Rather than run the install process, we are going to copy those modules manually.
On my server I have a folder called /Volumes/Documents/projects/apache2, you will want to pick an alternative destination.
I am not moving the modules into the traditional /usr/libexec/apache2/ because I do not want Apple altering my set up during the next operating system update. My preference is not to change folders and files seemingly managed by Apple.
Modify and issue the following copy commands to copy the modules:
cp subversion/mod_dav_svn/.libs/mod_dav_svn.so /Volumes/Documents/projects/apache2/. cp subversion/mod_authz_svn/.libs/mod_authz_svn.so /Volumes/Documents/projects/apache2/.
Add the Modules to Apache httpd
The final step is to tell Apache httpd where to find the restored svn modules. I do this using a separate configuration file; again aiming to reduce changes to Apple’s default configuration files.
In the file /etc/apache2/httpd.conf I have appended the single line:
This line tells Apache httpd to look for an additional configuration file in a folder on the volume Documents.
The contents of the svn.conf file should include at least the following two lines:
LoadModule dav_svn_module /Volumes/Documents/projects/apache2/mod_dav_svn.so LoadModule authz_svn_module /Volumes/Documents/projects/apache2/mod_authz_svn.so
After those two lines, you can follow the examples and instructions provided by the Subversion book; specifically the http, the Apache HTTP Server section.
Version Control with Subversion
You will need to restart your Apache httpd server after making changes to the configuration file. Any problems will be logged in the /var/log/system.log and /var/log/apache2/error.log files. Both these files are visible using the Console.app utility included with OS X 10.8.