Subversion Excursion: Details of Getting Started on OS X

I’ve set up my first personal Subversion repository.

By all accounts, Subversion is much easier than CVS. But setting up a personal repository on Mac OS X involves little steps that nobody seems to have written down anywhere yet.

First of all, don’t bother with all the packages listed in the MacDevCenter.com article “Making the Jump to Subversion”. For 10.3 “Panther,” all you need is one of these two packages:

  1. Martin Ott’s packages containing statically linked binaries for Mac OS X 10.3 Panther
    http://www.codingmonkeys.de/mbo/
  2. Metissian’s Mac OS X Subversion Packages
    http://metissian.com/projects/macosx/subversion/

Alas, neither works out of the box without further fiddling. What I discovered from Metissian’s README file is that it doesn’t install its utilities under any of the standard 10.3 PATH environment variable locations. Type echo $PATH in a Terminal window to see these locations for yourself. Instead, without any explanation (though I’m sure some Unix expert could give me theories), it puts them in /usr/local/bin. Under a standard 10.3 configuration, such utilities are not conveniently accessible.

There are perhaps half a dozen ways to add to your PATH environmental variable. Ask the above-mentioned Unix experts about their various merits if you want to while away an hour or two. The one I use is a .profile file in my home directory. See this sample profile.txt file. (Update: I accidently deleted the sample file. See the comments for other options.)

Now you can use Subversion utilities like svn from a Terminal window. Have a look at the Subversion book to see the steps needed from there to set up and access a same-machine Subversion repository.

I’ve heard rumors you need a ~/.subversion/config file to prevent a Subversion import from sucking in .DS_Store files, but my admittedly simple tests tonight show that this fear is unfounded.

I’m sure I’ll have more to say about Subversion, esp. about sample config files, but for now, that’s it!

11 comments

  1. Nat Irons

    I wouldn’t call myself a unix expert, but putting software you’ve installed in /usr/local/bin makes sense for the same reason as installing stuff in /Library instead of /System/Library — it’s your personal sandbox, and its contents won’t get stepped on by future updates from the mothership.

    Leaving /usr/local/bin off the default $PATH is arguably a sound security measure, since shell users are necessarily even less aware of the location of a binary they execute by typing its name than Mac users who doubleclick documents. Some systems (though not Mac OS X) make it easier to put executable software in /usr/local/bin than /usr/bin, which comprises the first half of an attack whose second half is users accidentally launching malicious code.

    Anyone running and installing unix software deserves a basic understanding of the workings of $PATH, and leaving /usr/local/bin out by default is a good institutional mechanism to suggest people gain that understanding. It’s not the Mac way, but this far below sea level, it’s not a Mac. With great power comes great yada yada.

  2. Larry Halff

    I’ve been happily running a SubVersion on MacOS X for a couple of months, and can’t imagine living without it. I was actually inspired to switch by http://projects.edgewall.com/trac/ , which I can’t praise enough.

    Despite what all sorts of howto’s say, I was only able to get a satisfactory server installation by compiling my own binaries, though the client binary provided on the Subversion site was just ducky.

  3. David Buxton

    /usr/local/bin is the standard directory for software installed on the local machine. This is Mac OS X’s BSD heritage shining through. The distinction between /usr/bin and /usr/local/bin is software which is installed as part of the operating system (/usr/bin) versus software which is installed on this particular machine (/usr/local/bin).

    Read `man hier` for more information.

  4. Nate Silva

    I’d love to hear about any GUI clients you try. So far I’ve found svnX which looks promising but has a long way to go; and scplugin, which sounds good but I couldn’t get it to work (and the author is in the middle of a major rewrite anyhow).

  5. Andy Peters

    Now that you’ve set up your client stuff, what are you doing for your repository? It’s rather simple to set up Subversion’s server, svnserve, and start it from xinetd. (You can run it through apache, but it requires apache 2 and OS X ships with apache 1, so that’s an extra step you probably don’t want to bother doing.) Once it’s up and running, you access your repository through a simple URL, like svn://mymachine/ — and you can do this from any machine on your network.

    I’m still waiting for an OS X equivalent to the Windows TortoiseSVN.

    -a

  6. josh

    I’m trying to setup a repository on my local machine, and after I run svnadmin create – the repository is created. But when I then try to access it, I keep getting the following error:

    svn: Unable to open an ra_local session to URL
    svn: Unable to open repository ‘file:///svnRepo/test1’

    Any ideas? I’d love to see some kind of tutorial or instructions on how to setup a svn server on OS X

  7. since1968

    P.S. If you don’t want to download and copy a profile file, it’s probably easier to do this anyway:

    1) open terminal
    2) assuming you’re using bash (os x default), type the following line:

    echo ‘export PATH=/usr/local/mysql/bin:$PATH’ >> ~/.bash_profile

    You can safely copy and paste that line into your terminal if you don’t want to type it. All it does is add the relevant folder to your environmental path variable.

    3) close your terminal window and then relaunch terminal. (The change won’t take effect until you do so)
    4) to confirm: type ‘echo $PATH’ to see that new value in the $PATH variable
    5) to confirm, x2: type ‘svn’. You should get a response from subversion.

    Hope this helps.

  8. krotti

    Maybe a random rant, but just thought you might be interested: I havent’ been able to proceed with Subversion at all, since at the very moment the Subversion (1.2.0 RC2) installer reached 100%, my G5 resigned completely. After trying every single trick unsuccesfully, I’m now waiting for a new hard drive from Apple, and sincerely hoping I’ll be able to access the data on the old one still…