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.
The 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 1.6.18 (r1303927)
compiled Jun 15 2012, 19:07:58
Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.apache.org/
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: http://pkg-config.freedesktop.org/releases/pkg-config-0.25.tar.gz
You will need to type the following:
brew edit pkg-config
The replace the two lines with url and md5 by:
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: http://www.apache.org/dyn/closer.cgi?path=subversion/subversion-1.7.4.tar.bz2
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:
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:
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:
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:
There add /usr/local/bin:
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/
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:
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:
/usr/lib/libpq.5.dylib: Mach-O 64-bit dynamically linked shared library x86_64
But the php library was both 32 and 64bit:
/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.