Subversion for Mac OS X with SMB support

Posted by Brian on April 22, 2007

Macintosh users who have attempted to host a Subversion repository on an SMB file server (such as a Windows server) and then access it by means of file:/// URLs will run into difficulty in doing so. This is the case even if FSFS is being used as the data store instead of Berkeley DB, due to how file operations are handled by Mac OS X for SMB filesystems.

This blog entry explains how to install Subversion with a patch applied to APR that provides usable support for repositories hosted on an SMB file server. While this will obviously not be as reliable as hosting a repository on a real Subversion server (accessed by svn:// or http:// URLs), it does suffice for situations that involve a limited number of users who occasionally access the repository.

See these other related blog entries for background information.

Subversion, Mac OS X, and SMB (October 5, 2006)
Responses to APR Patch (January 20, 2007)
More on Subversion, Mac OS X, and SMB (April 22, 2007)

Note: The instructions provided here apply to version 1.4.3 of Subversion. Future releases may require an updated patch to support repositories hosted on an SMB filesystem.

Requirements

Xcode Tools (http://developer.apple.com/tools/xcode/)
Subversion source code (http://subversion.tigris.org)
APR SMB patch (http://www.briandwells.com/main/Files.html)

Be sure to download both the Subversion source package and the “dependency package”.

Prepare Source

Copy the downloaded source archives into a folder on the hard drive. For best results, there should not be any spaces in the folder’s name or anywhere else in the path to the folder.

subversion-1.4.3.tar.bz2
subversion-deps-1.4.3.tar.bz2

Open the Terminal application, which is located in the /Applications/Utilities folder. Type the following command and then a space, but do not press Return.

cd 

Drag the icon for the folder that contains the source archives into the Terminal window. This will automatically enter the folder’s path, with a result similar to the following.

cd /Users/Shared/subversion_source

Extract the source archives with the following commands if they are in bz2 format.

tar xjvf subversion-1.4.3.tar.bz2
tar xjvf subversion-deps-1.4.3.tar.bz2

If the source archives are in gz format, use these commands instead.

tar xzvf subversion-1.4.3.tar.gz
tar xzvf subversion-deps-1.4.3.tar.gz

Change the current working directory to the one containing the extracted source files.

cd subversion-1.4.3

Apply Patch

Copy the downloaded patch file into the same folder where the source archives were placed. Then enter this command in the Terminal to apply the patch.

patch -d apr -p0 < ../apr_darwin_smb_patch

Build and Install

Enter these two commands to build Subversion and the required libraries with support for SSL encryption when accessing repositories stored on an Apache web server.

./configure --with-ssl
make

Using an administrator account for the computer, install Subversion with this command.

sudo make install

Installation Location

The Subversion executables are installed to the /usr/local/bin folder. To improve ease of use in the Terminal, that folder can be added to the PATH variable by appending this line of text to the /etc/bashrc file. To do so, open an editor for the file with this command.

sudo pico /etc/bashrc

Add the line listed below to the end of the file.

export PATH=${PATH}:/usr/local/bin

To save the file, press Control-O and then Return. Exit pico by pressing Control-X.