This is the programmer's quick and dirty reference to getting Subversion to work on Mac OS X. Remarkably there is little documentation on this and out of a need to document it for myself, I've decided that it might be worthwhile documenting in the blog.
Install Subversion
The first stage is to download the latest subversion package that Matt Ott has generously built for Mac users of SVN. To install the package just open the installer and follow the instructions. This should then install Subversion to: /usr/local/bin
Download svnX
svnX is an open source GUI for most features of the svn client binary.
This will allow you to browse your local working copies, commit changes, and perform basic SVN tasks such as filemerge, svn checkout, svn export, svn import, svn switch, svn copy, svn mkdir and svn delete.
Do a little reading
There is a great free book on using version control with Subversion (SVN), that has really deepened my understanding of how SVN works. Learning SVN in a GUI world is great, but it's important to understand the engine beneath the hood, and know how to use the command line syntax in the scenario that you are working on a server remotely through ssh.
Here are a few other good resources I've found on Subversion:
- Single User Subversion Tutorial
- Subversion Quick Reference
- Setting Up Subversion for One or Multiple Projects
- Also for those Windows users: How to Install and Use SVN
Since those links go pretty in depth with the setup and installation of SVN, I won't go in depth with the "how-to", but here are a few things I've found that are often omitted and are Mac specific.
Getting SVN to run on Apache
Rather than using the default version of Apache that is installed with Mac OS X, I prefer to use MAMP which stands for Macintosh Apache MYSQL PHP. MAMP installs a local server environment in a matter of seconds on your Mac OS X computer, be it PowerBook or iMac. Like similar packages from the Windows- and Linux-world, MAMP comes free of charge.
Once it's downloaded and installed you will want to include the necessary SVN modules into Apache, and create a location that ties to your SVN repository.
SVN over HTTPS
In the scenario where you are trying to access a SVN over HTTPS through the graphical tool svnX you will need to accept the SSL certificate by opening the terminal application, and typing:
svn list https://192.168.0.100/svn/name-of-repo
Permanently accept the certificate, and the credentials will be cached so you shouldn't have to do this again for the same server.
Recursive Removal of SVN Files
Though this is something that probably shouldn't happen under a well managed SVN, I have found at times that I want to put something under SVN that was previously under version control (Say CVS or an older SVN system). In this situation, a recursive delete of all the .svn folders and files is necessary. You could show all the hidden files and go into each folder manually and delete them, however, I much prefer the following approach:
First navigate to the root folder where you wish to begin the recursive delete in the terminal window. Then run the following command:
find . -name .svn -print0 | xargs -0 rm -rf
svn: '' is not a working copy directory
There have been a number of times where I have run into a lock or a conflict in the SVN. Normally running the command svn cleanup should fix this, but in the case it doesn’t here is how I have resolved it:
- Open the terminal and cd into the directory you need to fix
cd youroriginaldir - Run the command:
find . -name .svn -print0 | xargs -0 rm -rf - Now move into the directory above it
cd .. - Move the directory
mv youroriginaldir yourtemporarydestinationdir - Now run:
svn cleanup - Now run:
svn update - Now run:
svn st - You should see that there’s an ! mark next to youroriginaldir
- To fix this:
svn delete youroriginaldir - Now move your copy back:
mv yourtemporarydestinationdir youroriginaldir - Now add it back to the repository:
svn add youroriginaldir - Then commit the changes!
How to Move a Subversion Repository
To move your subversion repository from one server to another you have to enter a few commands. SSH into your server and then navigate to your svn root.
Then enter:
svnadmin dump /path/to/repository > name-of-repository.dmp
If the server file is quite large you can compress it using either tar, zip or whatever your favorite utility is.
tar -cf dump-file.tar name-of-repository.dmp
Then transfer the file to your server using ftp, or webdav.
ftp yourdomain.com
cd /place/to/dump/repository (remote change of directory)
lcd /home/user/path-to-repository (local change of directory)
put name-of-repository.tar
Now that it's on your server move it from wherever you uploaded it to, to the svn root.
mv name-of-repository.tar /path/to/new-repository
Now we need to move to that location, extract the dump from the tar file, and create a repository
cd /path/to/new/repository
tar -xvf name-of-repository.tar
svnadmin create name-of-repository
Then load the dump file
svnadmin load repository-name< repository-name.dmp
This method of moving the repository will work for transferring repositories between platforms (ie. Unix to Windows)
Configuring Apache 2.0 for Subversion and MAMP
The following is excerpted from Getting Control with Subversion and XCode from Apple. Although I have never integrated subversion into Apache myself, I believe this may help some users who wish to do this. I have integrated this with MAMP in steps that I think *should* work, but have not been tested.
To configure Apache 2.0 (or MAMP) for Subversion, complete the following steps:
1. Make the following change: in MAMP this is located within the Mamp/conf/apache/httpd.conf directory
* Add the path location for Subversion (SVN):
DAV svn
SVNPath /Applications/MAMP/repos
AuthType Basic
AuthName "YOUR AUTH NAME
AuthUserFile /Applications/MAMP/conf/svn-auth-file
Require valid-user
* Make sure to remove the whitespace between the braces in the location tag above
* Add Subversion modules to the end of the Modules section:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
You need to download the MAMP SVN modules (zip) and place them in the modules folder of Apache. You can do this by clicking on the MAMP folder and then navigating to Libraryrsquo;modules and copying the files from the zip.
For this to work you will need to get MAMP 1.7 and Subversion 1.4.5.
Next, create a file called svn-auth-file in /Applications/MAMP/conf/subversion using this command:
/Applications/MAMP/Library/bin/htpasswd -c /Applications/MAMP/conf/svn-auth-file username
(Thanks to Sam le Pirate for the comment)
Restart MAMP and you should be good to go.
Installing WebSVN
At WebSVN they offer an easy-to-use Web-based interface to your Subversion repositories. (At the time of this writing, the latest stable version of WebSVN was version 1.61 [WebSVN_161.tar.gz].)
To install WebSVN, complete the following steps:
- Open Terminal in Mac OS X, and then extract the package.
- Move the files to the websvn directory using the following command:
tar xvfz WebSVN_161.tar.gz
mkdir /Volumes/Storage/Apps/MAMP/htdocs/websvn (or wherever you have mamp located)
mv WebSVN/* /Volumes/Storage/Apps/MAMP/htdocs/websvn
- Point your browser to http://localhost:8888/websvn/index.php to browse your Subversion repository with WebSVN.

June 27th, 2007 at 1:43 pm
Can you describe the exact modules, and where to get them, to add to a MAMP installation to support subversion serving, and how to set this up? Thanks.
June 27th, 2007 at 2:35 pm
Hey! Well I gave a shot at what seemed logical to me. I found some resources on Apple’s dev site to do with integrating subversion into MAMP. Take a look above, give it a shot, and let me know if it works.
June 29th, 2007 at 6:55 am
Thanks. The revisions above are useful — here are some further comments. The collab.net installer does seem to come with all of the required modules if you use their latest installer. It puts the apache ones in /usr/local/lib/svn-apache and you can either copy them or soft-link them to the equivalent names in your /Applications/MAMP/Library/modules/ area, saving additional hunting and downloads. The path loction you refer to above is the location of the repository, of course.
July 9th, 2007 at 5:06 am
Well, this didn’t work, with either the modules that came with Mamp or the ones you provided above. I get “/mod_dav_svn.so is garbled - perhaps this is not an Apache module DSO?” Googling shows this to be a common problem.
My Mac is a PPC one, if that matters. Posting by others who may have found a solution to this problem would be appreciated.
July 10th, 2007 at 5:47 am
OK, sorry for so many posts to your blog on the same topic, but perhaps this will be useful to someone trying to do something similar.
The problem with the above apache modules is that the CollabNet downloads are built for a newer version of Apache (2.2.4) than the ones currently in MAMP (2.0.59). This is not easy to resolve. Apparently one has to build a consistent set of subversion, apache, etc. all with the same versions of components and not approach them piecemeal.
Does anyone know how to replace the Apache in MAMP with a newer version? Or would that mess up the PHP componetns also?
July 13th, 2007 at 2:15 pm
Hmmmm…. not sure how best to resolve this issue. I imagine you could upgrade Apache within the MAMP package, but I’ve never tried.
Are there archived versions of the CollabNet downloads? Perhaps one could ask the author of the site for a 2.0.59 build of the SVN module. They surely must have one.
September 4th, 2007 at 1:34 pm
this modules has been compiled for mamp 1.7 and it works for me with a standard installation using subversion 1.4.5.
http://samuel.toulouse.free.fr/svn_mamp_1_7.zip
i’ve added to httpd.conf:
LoadModule authz_svn_module modules/mod_authz_svn.so
LoadModule dav_svn_module modules/mod_dav_svn.so
DAV svn
SVNPath /Applications/MAMP/repos
AuthType Basic
AuthName “Pirate & Co. Repository”
AuthUserFile /Applications/MAMP/conf/svn-auth-file
Require valid-user
and created a file called svn-auth-file in /Applications/MAMP/conf/subversion using this command:
/Applications/MAMP/Library/bin/htpasswd -c /Applications/MAMP/conf/svn-auth-file username
November 29th, 2007 at 3:41 pm
I get an error, I don’t understand why, could someone help me ?
> root@powerbook-2[192.168.x/x]:/Users/xxx# /Applications/MAMP/bin/apache2/bin/apachectl restart
Syntax error on line 290 of /Applications/MAMP/conf/apache/httpd.conf:
Cannot load /Applications/MAMP/Library/modules/mod_authz_svn.so into server: Library not loaded: /usr/local/lib/libsvn_subr-1.0.dylib\n Referenced from: /Applications/MAMP/Library/modules/mod_authz_svn.so\n Reason: image not found
December 5th, 2007 at 11:36 pm
I have the same problem as Couzy. How can we solve this?
December 6th, 2007 at 8:13 am
What’s on line 290? Is it just the LoadModule?
February 4th, 2008 at 7:37 pm
i’m having the same problem. and yeah, it’s the LoadModule line that causes the problem.
February 29th, 2008 at 2:26 pm
Got that same issue. Mine actually at line 288 - and it says it can’t find libaprutil-0.0.dylib
March 19th, 2008 at 9:27 am
The binary (http://samuel.toulouse.free.fr/svn_mamp_1_7.zip) are only for Intel Mac
$ file mod_dav_svn.so
mod_dav_svn.so: Mach-O bundle i386
And I get the same error as I’am running on a Mac Mini PPC : Cannot load /Applications/MAMP/Library/modules/mod_dav_svn.so into server: cannot create object file image or add library
And thoses included with subversion 1.4.6 are PPC and Intel but for apache 2.2. MAMP use apache 2.0.59.
Then, both solutions are not working for me.
If someone have another idea …
Thanks,