Setting up SVN on Mac OS X – Quick & Easy

You’ll find quite a lot of guides showing you how to install an svn server on your Mac OS X machine. But most of them don’t tell you, that Mac OS X ships with a fully functional svn system. This is how you configure it.

Start of by opening Terminal and creating a new folder holding your future svn repositories:

sudo mkdir /usr/local/svn

Make sure you change the folder’s owner to “www” in order to make it accesable through apache:

sudo chown -R www:www /usr/local/svn

Now create a new repository:

sudo svnserve create /user/local/svn/foo

where foo is your repository’s name.

Make sure, apache is running by checking your system preferences and enabling web sharing.

Now create a new file named svn.conf and place it in /etc/apache2/other. Type the following into the file:

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

Restart apache by typing

sudo apachectl graceful

into your terminal. And you’re ready and set. Access your repository through http://localhost/svn.

Share
  1. Hi,

    after typing http://localhost/svn i got

    Forbidden

    You don’t have permission to access /svn on this server.

    Can you help me what the reason is?

  2. Accessing http://localhot/svn through your Browser won’t work, unless you use a browser based subversion tool like webSVN. Use a subversion client software or a built-in subversion client for eclipse (or whatever IDE you’re using) to access and browse the subversion repository.

  3. On OSX Snow Leopard server there doesn’t appear to be a /usr/local directory what am I missing?

  4. I can not verify if /usr/local on Mac OS X Snow Leopard Server exists or not, because I do not have access to a machine running Snow Leopard Server. But I would certainly be suprised, if it did not exist.

    If not, choose a different directory for storing your repositories.

  5. On a fresh install of OS X Snow Leopard Server there is no /usr/local directory:


    macminiserv04:~ me$ cd /usr
    macminiserv04:usr me$ ls -a
    . X11 bin libexec share
    .. X11R6 lib sbin standalone

    But you can just create it and then use the rest of this excellent guide :)

    Well, until you try and do this:

    macminiserv04:svn me$ sudo svnserve create /usr/local/svn/my_repository
    Type 'svnserve --help' for usage.

    You’ll have to use:

    macminiserv04:svn me$ sudo svnadmin create /usr/local/svn/my_repository

    After those mods, everything is just dandy :)

  6. Thanks man, that really helped! But was a bit difficult for me, anyway it work! Thumbs Up! :mrgreen:

Leave a Comment