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.

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.




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
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
i still can’t get this to work. whenever i try to get to the “localhost/svn/foo” it says page not found. do i need “web sharing” on (tried it both ways) – i’m assuming i’m missing something easy here…
By jason on Aug 7, 2008
Jason, yes you will need to enable web sharing. Basically, web sharing starts Apache up for you.
By Chris on Aug 29, 2008
hi jason, I am getting the same error as you. i am not sure why. one thing i noticed in the “make repository” section is that the 2nd line is pointing to a different path than the 3rd and 4th lines. is that on purpose?
By lockheartmac on Sep 9, 2008
Thanks so much! You are my hero`-`
I spend all day trying to figure this out, and not until I found your wonderful straight forward tutorial could I figure it out.
Thanks so much`-`
Johnny
By John Barrett on Jan 10, 2010
Wow … you saved my day too! Cool short description, man! So glad, I stumbled over it.
By iMick on May 10, 2010