I wrote an article about a year ago, about svn (Subversion) being missing in Mountain Lion (10.8) and how to install it manually. Since then, I’ve got a new mac and have used myself this post to install it on the new machine. Since then there has also been new versions of subversion but unfortunately all my software are not compatible with it. So I’ve been looking into this topic again and wanted to share.
Another way to install svn on mac is to use a ditribution package from wandisco. They are available here. Do not use the packages on CollabNet which are outdated.
Unzip the .pkg file and double click on it and follow the instructions to have it installed.
I still like it better with Homebrew since it makes it very easy to upgrade the packages and switch between packages.
To find out the version currently active with Homebrew:
brew info subversion
You can check the versions of subversion which are available using:
brew update brew versions subversion
This will return multiple lines, one per version, each containing a version number and the checkout command e.g.:
1.8.1 git checkout 55577bb Library/Formula/subversion.rb
Choose the version you want to install e.g. here 1.8.1, switch Homebrew’s prefix,checkout the package and install it:
cd `brew --prefix` git checkout 55577bb Library/Formula/subversion.rb brew install subversion
Then reset the formula:
git checkout -- Library/Formula/subversion.rb
You can then switch between versions using brew switch (which updates the symlink in /usr/local/bin to the specified formula version in the Homebrew cellar) e.g.:
brew switch subversion 1.7.3
Of course mechanism can be used for any other Homebrew package.
If you get errors in XCode while accessing working copies created with a newer version, you might need to link the newer version into XCode by doing the following:
- Create a backup directory for the svn binaries currently used by XCode
- Moving the current binaries to the backup folder
- Linking the binaries of the new version installed with Homebrew into Xcode (as a replacement for the moved ones)
You can do that by executing the following and replacing 1.7.4 by the actual subversion version you want to use in XCode:
mkdir /Applications/Xcode.app/Contents/Developer/usr/bin/save mv /Applications/Xcode.app/Contents/Developer/usr/bin/svn* /Applications/Xcode.app/Contents/Developer/usr/bin/save/ ln -s /usr/local/Cellar/subversion/1.7.4/bin/svn* /Applications/Xcode.app/Contents/Developer/usr/bin/
Note that you can also use Homebrew-versions instead. It provides multiple formulas for different versions of existing packages e.g. subversion1.6 and subversion1.7. If you use it, you will of course not be able to upgrade from 1.7 to 1.8 but only from 1.7.2 to 1.7.3 but it’s maybe what you are after…
You can install from Homebrew-versions using:
brew install https://raw.github.com/Homebrew/homebrew-versions/master/subversion17.rb
You’ll notice that Homebrew-versions only has packages for subversion 1.6 and 1.7. But I guess 1.8 should come soon.
So there are quite a few ways to install subversion on your mac and handle different versions. The one I like best is still just installing it with Homebrew and switching to the one I use most. The other versions are still available by other switching to a particular version as shown above or by using the svn command from a particular version in the Homebrew Cellar e.g.