Victor Quinn

Software Engineer, Legal Scholar, Problem Solver.

Solved: Git Svn Broken in Mountain Lion

On Thursday, February 16 2012, Apple released the first beta of OS X 10.8 named Mountain Lion to Developers. I will refrain from discussing anything about the upcoming release for fear of violating Apple’s NDA, but I did come across one problem that interfered with my workflow which I solved and the disclosure that solution will not violate the NDA.

I use git to connect to my employer’s subversion server. I was using a package called git-svn which includes connectors between the two systems. Upon upgrading to the Mountain Lion beta, my git svn commands stopped working. The solution follows.

Install Xcode

First, install the latest version of Xcode (version 4.4) for Mountain Lion. An interesting note is that in Mountain Lion, Apple decided to move it from its former home in /Developer/Xcode to /Applications/Xcode. This was the root source of many of the issues as many of the utilities were searching in the wrong place for the appropriate binaries.

Install Xcode Command Line Tools

Another change they’ve made is that the command line tools are no longer installed by default. Previously, they were included with Xcode with no additional installation necessary. To install the command line tools, launch Xcode, open the Preferences, and switch to the Downloads tab:

One of the entries there is Command Line Tools. Mine already says Installed as I’ve already installed it, but if you haven’t, it’ll appear as an Install button as the iOS 4.0 and 3.0 Device Debugging Support entries do in my screenshot above.

Link the svn Libraries

After this, you may be tempted to run a git svn command and see what happens. I received the following output:

Can’t locate error
1
2
3
4
5
$ git svn rebase
Can't locate SVN/Core.pm in @INC (@INC contains: /usr/local/Cellar/git/1.7.9.1/lib /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library
/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.4 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/P
erl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .) at /usr/local/Cellar/git/1.7.9.1/libexec/git-core/git-svn l
ine 41.

The problem here is that the git svn command requires Perl libraries that aren’t linked in Mountain Lion. [1] So, we’ll have to manually link them. Run the following in your terminal to link the library:

Link the second library
1
$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Library/Perl/5.12/darwin-thread-multi-2level/SVN /System/Library/Perl/Extras/5.12/SVN

Now when you run git svn rebase you will likely be presented with a different error. This is good because it indicates progress! But obviously poor because it’s not working.

Can’t locate error
1
2
3
4
5
6
7
$ git svn rebase
Can't locate loadable object for module SVN::_Core in @INC (@INC contains: /usr/local/Cellar/git/1.7.9.1/lib /Library/Perl/5.12/darwin-thread-multi-2level /Library/
Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.4 /System/Library/Perl/5.12/darwin-thread-mult
i-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .) at /System/Library/Perl/Extras/5.
12/SVN/Base.pm line 59
BEGIN failed--compilation aborted at /System/Library/Perl/Extras/5.12/SVN/Core.pm line 5.
Compilation failed in require at /usr/local/Cellar/git/1.7.9.1/libexec/git-core/git-svn line 41.

So now it appears it can find the Subversion core, but cannot find some other libraries it requires. Issue the following command to remedy this:

Link the second library
1
$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Library/Perl/5.12/darwin-thread-multi-2level/auto/SVN/ /System/Library/Perl/Extras/5.12/auto/SVN

By doing this, we’ve now linked all of the Subversion Perl directories necessary for this command to run correctly.

Update - March 19 I installed Mountain Lion DP2 over the weekend which broke this again. However, my exact instructions still applied and fixed the issue. I simply needed to install the latest version of Xcode 4.4 (available from developer.apple.com) and then run the commands listed above.

  1. Note, I am using the version of git from Homebrew. Your outcome may differ slightly if you are using a different version or not using Homebrew.