Gilles Ruppert

a.k.a. elduderino78

Upgrading the Subversion Command Line Client on Mac OSX Leopard

UPDATE: Since I wrote this post, I found a couple of other ways of upgrading the Subversion command line client.

One option is to install the package via MacPorts or Homebrew. If you use Homebrew, you probably don’t have to do anything else, as Homebrew sets up the symlinks automatically. If you install via MacPorts, you have the same issue as you do with the Collabnet installer.

Instead of creating symlinks though, you can also change the PATH environment variable. To do this, open ~/.bash_profile or ~/.bashrc in your favourite editor (vim) and make sure that you have a line similar to this:

1
export PATH=/opt/local/bin:/opt/local/sbin:$PATH

This will make sure that /opt/local/bin/, which contains the MacPorts installs, will be checked before any other locations. MacPorts should add this by itself. This makes sure that svn as installed by MacPorts will be used.

As before: you can check which svn binary you are using by typing which svn and svn --version in the terminal.

Hope this helps!

Original post

OSX Leopard ships with Subversion 1.4.x by default. Since then, SVN has had 2 major upgrades (merge tracking anyone?). To make things easy, there is a binary availableĀ atĀ Collab.net. But unfortunately you need to do some work yourself.

The path of the built in Subversion command line client is different to the one that the Collab.net Community binary is installed to. The following steps will fix this.

Disclaimer - Be careful: when you use the Terminal you are flying without a safety net! No undo & no restore from trash. Do this at your own risk and don’t forget to have an up-to-date backup!!!

  1. install the binary downloaded to Collab.net
  2. open your Terminal and check which version of SVN you are using by typing svn --version. This should say 1.4.x
  3. check which installed instance of SVN the OS is using by typing which svn. This will return the path to the SVN version you are using, which probably is /usr/local/bin/svn
  4. check whether the Collab.net version is installed by going to it: cd /opt/subversion/bin. Doing an ls should show you the subversion files
  5. Backup the current svn location: by going to it (cd /usr/local/bin) and copying it to your desktop or wherever you fancy (mv svn* ~/Desktop/)
  6. now you need to create symlinks to the Collab.net binaries:
    • ln -s /opt/subversion/bin/svn svn
    • ln -s /opt/subversion/bin/svnadmin svnadmin
    • ln -s /opt/subversion/bin/svndumpfilter svndumpfilter
    • ln -s /opt/subversion/bin/svnlook svnlook
    • ln -s /opt/subversion/bin/svnserve svnserve
    • ln -s /opt/subversion/bin/svnsync svnsync
    • ln -s /opt/subversion/bin/svnversion svnversion
  7. That should be it

The beauty is that you only need to do this once. The next time you upgrade your Subversion client, the symlinks will just point to the updated files and everything should be fine. As I said earlier though: only do this if you feel comfortable on the command line.

UPDATE: I have been told that some people seem to have SVN installed in /usr/bin/. Just use the path that is returned by the which svn command. You might also need to use sudo to run some of the command (i.e. move).