Use SVN 1.7 in XCode 4.3+

tl;dr: Skip to the good part!

A while back, Subversion 1.7 was released. It was a major upgrade, and included an entirely new way of internally keeping track of local working copies. Unfortunately, the svn tools in XCode 4 are not compatible with the new format, and thus could not read the status of (or commit) code on the server.

Luckily, someone figured out a way to ‘patch’ Apple’s default SVN files with the new version. I first saw this on StackOverflow, and used it successfully for a few months waiting patiently for XCode to be updated.

Soon enough, there was a new version of XCode! And it was available through the Mac AppStore! And I had to spend a ridiculous amount of time working on my Hackintosh to get it upgraded to 10.7.3 so I could use the new version! …But that’s a story for another time.

After installing 10.7.3 and downloading XCode 4.3.1 from the Mac AppStore, I started it and immediately went to the repositories section, expecting to see my working copies listed and ready to be updated and committed. Unfortunately, what I got instead was a bunch of errors and “Cannot connect to repository” messages. I realized that the AppStore verson of XCode included it’s own copies of the SVN binaries, and wasn’t even using the ones that I had patched earlier. After looking a bit further, I realized that the new version of XCode had the SVN binaries packaged inside XCode.app. So how could those be updated to the new version?

The Good Part (AKA How To Upgrade to SVN 1.7 in XCode 4.3.x)

The good news is, upgrading SVN inside the XCode.app package isn’t too different from upgrading the old way.

This assumes you already have SVN 1.7 installed to /opt/subversion. You can get it from WANdisco (scroll down to the Vanilla Subversion section).

First, open Terminal and get an elevated shell using {shell}sudo -s{/shell} and typing in your password.
[shell]
tommylaptop:~ Tommy$ sudo -s
Password:
[/shell]

Then, cd to inside the XCode.app package, to where the SVN binaries are.
[shell]bash-3.2# cd /Applications/Xcode.app/Contents/Developer/usr/bin/[/shell]

Make a backup directory and move the old SVN files into it
[shell]
bash-3.2# mkdir bup
bash-3.2# mv svn* bup/
[/shell]

Lastly, symbolically link the new files into the package:
[shell]bash-3.2# ln -s /opt/subversion/bin/svn* ./[/shell]

That’s it! Note that this doesn’t seem to work 100% of the time (I still get random error messages sometimes), but it’s still nice to see the working copy status next to each file in the project, and be able to commit/revert from inside XCode. Also note that an update to XCode could break this – hopefully, by upgrading the SVN components *cough* – but the same procedure will probably work to restore SVN 1.7 functionality if the next update fails to deliver.

18 thoughts on “Use SVN 1.7 in XCode 4.3+

  1. This totally worked. Bless you for posting it… I’m so effing sick of having to fix various issues with XCode and SVN.

  2. Pingback: Rehsco Blog » Xcode 4, Subversion and Mac OS X Lion Server

  3. Pingback: dev environment | Pearltrees

  4. Hi,

     

    Thanks man, it really helped. Hope that the Apple will release the new XCode with svn1.7 version support built in.

     

  5. thanks. I have to use SVN and I needed 1.7 and I updated Xcode that way.

    I installed my svn 1.7 in /usr/bin as opposed to /opt/bin though

  6. i used the command

    $ which svn

    to get the path to the current installed svn.

    and then to symbolically link:

    $ sudo ln -s <PATH_TO_CURRENT_INSTALLED_SVN>* ./

    so for example:

    $ which svn
    /opt/local/bin/svn
    $ sudo ln -s /opt/local/bin/svn* ./

  7. Thanks, BIG thanks,

    Searching for solution of “unable to load revisions” for two days….

    Just cant think that xCode can use his own binaries of SVN, stupid APP !

    I have upgraded svn client in OSX and cant understand why it isnt working.

    Checked CERTIFICATE, permissions on AUTH folder, Credentials … ALL possible solution.

     

    You did the trick, good work, Thanks BRO

  8. Worked great until now with all SVN 1.7.x. Thanks for that!

    Unfortunately it doesn’t work anymore with SVN 1.8.

    Any idea?

  9. It does not work for xCode 4.6.3.

    I following the procedure and when I tried to commt, I got the following error msg:

    The operation could not be performed because no valid working copies were found.

Comments are closed.