Installation and Setup of Subversion on Mac OS X

After finally getting round to setting up version control for my personal sites I thought i’d record the process of installing subversion on my Mac and setting up the repositories for future reference.

Installation

First i needed to create a .bash_login file and set the PATH:

mate ~/.bash_login
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"

I found it is important to have /usr/local/bin and /usr/local/sbin  first in the path.

. ~/.bash_login

Next I downloaded, extracted and configured ‘subversion’, before installing it:

curl -O http://subversion.tigris.org/downloads/subversion-1.3.2.tar.gz
tar xzvf subversion-1.3.2.tar.gz
cd subversion-1.3.2
./configure --prefix=/usr/local --with-openssl --with-ssl --with-zlib
make
sudo make install
cd ..

Ignore warnings about “missing” Berkeley DB.

Setting Up Repository

Next I created the svn directory and repositiory:

mkdir /usr/share/svn
svnadmin create /usr/share/svn/repos

Then importing my projects into the repository I just created,  e.g. if the project i’m working on is currently in /katie/sites/project:

cd /katie/sites
svn import project file:///usr/share/svn/repos/
           project -m "Initial import"

Now I have a repository of the project I must check out a working copy:

svn checkout file:///usr/share/svn/repos/project

Committing Modified Files

When trying to commit files I had modifed to the repository i encountered the following error:

svn: Can’t open file ‘/usr/share/svn/repos/db/txn-current-lock’: Permission denied

This is  a simple permissions problem, you need to have write permission on the repository directory:

sudo chown -R $(id -u):$(id -g) MyDirectory chmod -R u+w MyDirectory 

Leave a comment