January 21, 2008 – 9:50am svn, apache2, os x leopard 10.5

Mac OS 10.5 Leopard ships with Apache2 and SVN. However, if you want to keep a local svn repository and not use an external svn server (only really useful if you have projects which you will be the only developer), you have to set up the repository yourself. Here is a quick cheat-sheet to help you do just that.

Make the repository

Substitute REPOSNAME with the name of your repository (aka the project name).

$ sudo mkdir /usr/local/svn
$ sudo mkdir /usr/local/REPOSNAME
$ sudo svnadmin create /usr/local/svn/REPOSNAME
$ sudo chown -R www:www /usr/local/svn/REPOSNAME

Configure Apache

I used textmate to edit a new text file named svn.conf, you can use vi or whatever you want.

$ cd /etc/apache2/other
$ mate svn.conf

Inside /etc/apache2/other/svn.conf:

LoadModule dav_svn_module /usr/libexec/apache2/mod_dav_svn.so
<Location /svn>
  DAV svn
  SVNParentPath /usr/local/svn
</Location>

And now restart apache…

$ sudo apachectl graceful

Finally, check out your repository to make sure it worked: http://localhost/svn/REPOSNAME.

svn apache2 leopard

Final notes

You may want to secure access to your repository through a password file. In a nutshell, you can use something like sudo htpasswd -cm /etc/apache2/auth/svn USERNAME (you can create this file anywhere but I like to keep all my auth files in a custom “auth” directory). Then edit your svn.conf file and add these lines right before the closing ‘Location’ tag:

Inside /etc/apache2/other/svn.conf:

AuthType Basic
AuthName "SVN"
AuthUserFile /etc/apache2/auth/svn
Require valid-user

If you need more detailed instructions you should head over here.

Posted in  OS X Web Development   |     |  delicious  Digg

2 Responses to “svn, apache2, os x leopard 10.5”

  1. Short and greatful description! It works after one minute. Is it also easy to use https://? I’m a beginner with Mac OS and with Apache - but not with Subversion (luckily!).

    Lars

    By Lars on Apr 20, 2008

  2. I’ve never done this before, however these resources may help:
    1. Configure Apache to use SSL: http://developer.apple.com/internet/serverside/modssl.html

    2. Set up SVN: http://svnbook.red-bean.com/en/1.0/ch06s04.html#id2734751

    By Scott Meves on Apr 20, 2008

Post a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word