Mac OS X: SVN (Subversion) missing in Mountain Lion (10.8)

After upgrading to Mountain Lion, I realized that subversion (svn) was missing. Since I happened to install a new version of eclipse I first thought the problem was with my eclipse install but after wasting way too much time trying to fix it in eclipse I realized my problem was somewhere else…

So here’s what I did to fix it. SVN is part of the Command Line Tools. To install them go to Downloads for Apple Developers. This requires an Apple Developer ID. Getting one is free and only requires an Apple ID which you should all already have.
There select Command Line Tools (OS X Mountain Lion) and download the DMG file (it’s about 110 MB). Then open the DMG file, double click on Command Line Tools (Mountain Lion).mpkg, just keep clicking Continue / Agree / Install.

An alternative is to install Xcode. You can download it from the Mac App Store. Once Xcode is installed, you can go the Preferences > Downloads > Command Line Tools and install them.
Xcode install command line toolsThe downside of this method is that you have to install Xcode which is a waste of space (1.5 GB download and 3.3 GB install) unless you develop for Mac OS X or iOS. But if like me you have Xcode installed anyway…

Once you’ve installed the Command Line Tools, you can check whether SVN is installed and whether you have the right version (1.6.18) opening a Terminal and typing the following:

svn --version
svn, version 1.6.18 (r1303927)
   compiled Jun 15 2012, 19:07:58

Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
  - handles 'http' scheme
  - handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme

That’s it !

Update: Another way is to use Homebrew or MacPorts.

With Homebrew installed, open a Terminal window and type the following:

brew install subversion

If you get the following error:

curl: (22) The requested URL returned error: 503
Error: Download failed:

You will need to type the following:

brew edit pkg-config

The replace the two lines with url and md5 by:

  url ''
  md5 'a3270bab3f4b69b7dc6dbdacbcae9745'
  version '0.25'

Save and rerun the install of subversion. If you get the following error message:

curl: (22) The requested URL returned error: 404
Error: Download failed:

This means that your HomeBrew installation should be updated. It should fetch subversion 1.7.5 instead of 1.7.4. You can update it with the following command:

brew update

Then rerun the subversion install.

If the installation of subversion or an upgrade to a newer version gets stuck (this happens to me every time), with the following last line written to the console:

==> make

Just kill it with CTRL-C and restart it. In my case, it always gets stuck for hours the first time and works the second time…

After the install, you might see when running svn –version that it doesn’t say 1.7.5. This is because the new version is installed in /usr/local/bin and there is an older version in /usr/bin. If your PATH looks like this:

echo $PATH

Then you’ll see the svn program in /usr/bin because it is before the /usr/local/bin in PATH. So you need to update your PATH so that /usr/local/bin comes before /usr/bin:

vi ~/.profile

There add /usr/local/bin:

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

If you want to have a subversion integration in Eclipse, you’ll need the java bindings. To install them using Homebrew execute the following:

brew install --universal --java subversion

Universal means it will install both 32 and 64bit version (without this the java bindings will most probably not work fine). And the Java option tells Homebrew to additionally install the Java bindings.

If you’ve already installed subversion using Homebrew without the java bindings, you can just uninstall it and reinstall it with the bindings:

brew uninstall subversion
brew install --universal --java subversion

If you get messages saying you need to first remove some packages, remove them, they will be reinstalled when installing subversion, e.g. I had to remove neon and serf:

brew rm neon serf

After installing with the bindings, there will be some instructions about links to be created. It’s important to create these links. On my machine and with subversion 1.7.7, it said:

You may need to link the Java bindings into the Java Extensions folder:
  sudo mkdir -p /Library/Java/Extensions
  sudo ln -s /usr/local/lib/libsvnjavahl-1.dylib /Library/Java/Extensions/libsvnjavahl-1.dylib

Unfortunately, on my machine the Eclipse integration still didn’t work… Until I noticed the instructed linked was not completely right:

ls -l /Library/Java/Extensions/
total 16
drwxrwxr-x  4 root  admin  136 Nov 30 21:36 .
drwxr-xr-x  5 root  wheel  170 Oct 25 22:33 ..
lrwxr-xr-x  1 root  admin   35 Nov 30 21:36 libsvnjavahl-1.dylib -> /usr/local/lib/libsvnjavahl-1.dylib
lrwxr-xr-x  1 root  admin   40 Dec 21  2011 libsvnjavahl-1.jnilib -> /opt/subversion/lib/libsvnjavahl-1.dylib

So basically the link was created with the wrong them. So just had to do the following to solve the problem:

cd /Library/Java/Extensions/
mv libsvnjavahl-1.jnilib libsvnjavahl-1.jnilib.sav
mv libsvnjavahl-1.dylib libsvnjavahl-1.jnilib

If like Julio, you have some error messages related to libpq.5.dylib having a wrong architecture, you can try the following:

find / -name "libpq.5.dylib"

This will find all occurrences of this library. On my machine, it found it there:


Checking the one in /usr/lib, you see that it’s a 64bit only library:

file /usr/lib/libpq.5.dylib
/usr/lib/libpq.5.dylib: Mach-O 64-bit dynamically linked shared library x86_64

But the php library was both 32 and 64bit:

file /usr/local/php5/lib/libpq.5.dylib
/usr/local/php5/lib/libpq.5.dylib: Mach-O universal binary with 4 architectures
/usr/local/php5/lib/libpq.5.dylib (for architecture i386):	Mach-O dynamically linked shared library i386
/usr/local/php5/lib/libpq.5.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
/usr/local/php5/lib/libpq.5.dylib (for architecture ppc7400):	Mach-O dynamically linked shared library ppc
/usr/local/php5/lib/libpq.5.dylib (for architecture ppc64):	Mach-O 64-bit dynamically linked shared library ppc64

So you probably only need to replace the one in /usr/lib by this one:

sudo mv /usr/lib/libpq.5.dylib /usr/lib/libpq.5.dylib.only_64
sudo cp /usr/local/php5/lib/libpq.5.dylib /usr/lib/libpq.5.dylib

If you still have problems when integrating svn with eclipse, please a have look at this post.

Note that I’ve written a new post to show how to handle multiple subversion version using brew.

22 thoughts on “Mac OS X: SVN (Subversion) missing in Mountain Lion (10.8)

  1. Pingback: Install subversion | Zyxtv
  2. I had exactly the same problem. Since I had XCode already installed it was an easy fix following your instruction. Thanks!

  3. This gave me problems, like…

    imac-de-julio:Downloads julio_graffin17$ $ brew install subversion
    -bash: $: command not found

    In case, this line command is invalid, right?
    How can i resolve this?

    PS: The first step, just using Xcode and line command tools does’nt work, thats why i’m just trying with HomeBrew. Note, i’m a designer and i do not have so much experience with line commands lol.

    1. You should not write the dollar sign before the command. The one you see in the blog is just the one you have after “imac-de-julio:Downloads julio_graffin17$” in your case.
      So just type the following: brew install subversion

      1. Wow,
        It works! Thanks!
        But, i have another problem , my Aptana Studio still searching for Native JavaHL Library…

        Failed to load JavaHL Library.
        These are the errors that were encountered:
        no libsvnjavahl-1 in java.library.path
        /opt/subversion/lib/libsvnjavahl-1.0.dylib: Library not loaded: /usr/lib/libpq.5.dylib Referenced from: /opt/subversion/lib/libsvnjavahl-1.0.dylib Reason: no suitable image found. Did find: /usr/lib/libpq.5.dylib: mach-o, but wrong architecture /usr/lib/libpq.5.dylib: mach-o, but wrong architecture
        no svnjavahl in java.library.path
        java.library.path = .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java

        … What can i do?
        Thank’s a lot!

        1. The issue seems to be that the library (libpq.5.dylib) is only available in 64bit on Mountain Lion. There are only 3 solutions, either not to use the native JavaHL library, manage to get a 32 bit library or manage to run it all in 64 bits. Since I don’t have a machine here to test it, I’ll need to check later.

          1. Check whether my last update to the post helps (first installing with Homebrew including the Java integration and if it doesn’t help, the part with copying the library)

  4. Pingback: 天蓝–文章有泪的博客 » Blog Archive » 关于OS X自带SVN命令行问题
  5. Thank you very much for the post. I did all these steps. but I still have problem. it says “There was a problem while connecting to frost:22”. After installing SVN how should I use it?

  6. Pingback: SVN unter Mountain Lion installieren | Pascals BlogPascals Blog

Leave a Reply

Your email address will not be published. Required fields are marked *