Getting both Git and Subversion to play nicely on OSX is a feat and a half. I spent the last few weeks fighting with the default install of Perl (outdated 5.8.6), bindings, CPAN, and a mess of port options just to get git-svn working properly. Why would I want to use git-svn? Well, a project that's been in the works for a bit has finally made its way onto Google Code, which uses SVN for source control. This is a great thing, aside from the fundamental problem in SVN, which is commit access and trust networks. There are people who can explain the shortfalls of Subversion better than me. More importantly, once you've decided that distributed source control is a valuable thing and want to use it on your Mac, you're in for a whirlwind of excitement. Hopefully, this step by step guide will iron out the kinks and get you running git-svn in no time.
Step 1: Getting MacPorts, Installing Base Software
Update Aug 08: It was pointed out that you need the OSX Developer Tools installed. They are on the OSX CD, and enable the ability to compile things. It's a must have for this to work.
We're skipping the Fink v MacPorts (formerly Darwinports) discussion completely. The simple answer for this is that MacPorts has the builds we need at the versions we want. You're more than welcome to tackle this with Fink, as the concept will be identical. The absolute first thing you need to do is grab the MacPorts installer and get it up and running. Open the .dmg file, install, open a Terminal window, and run:
This will bring MacPorts up to date, and ready to do the installs. To get git-svn up and running, we'll need ultimately Git (1.5.2.3), Subversion (1.4.4), and the dependancies for the SVN/Perl Bindings. With the ports collection installed, we'll install the Git Core, Subversion, and SWIG (a dependancy for the perl bindings).
Yikes, that's a lot of dependancies! That's okay though, the ports collection will handle adding everything you need. As an added bonus, it will all be in /opt/local, meaning your normal OSX software remains untouched. Once up and running, you'll notice that the version of Git provided by MacPorts is slightly out of date. We can fix that, but at least all the dependancies are now in place. From here, we can build our missing gaps from source files.
Step 2: Build from Source
We'll need to download the latest Git and proper Subversion. Go grab those tar.gz files, and take care to match up your Subversion download to the version installed by MacPorts. You can find that by entering at the Terminal:
You'll need at least Subversion 1.4.4 for this to work, although I'm sure newer revisions would work as well. With both downloaded, we'll install first Git, and then the Subversion Perl bindings. Open a Terminal window, cd to the location of your Git download, untar it, and run the following commands
By setting the prefix to /opt/local, we'll overwrite the current Git install with our new version, including the new git-svn scripts we'll be wanting. Attempting to run it though informs us that the svn-swig libraries are not in place yet. We'll need to make those.
We won't be installing all of Subversion. Instead, we will be going all the way up to the install step and stopping. This way, we have the svn binary, working swig and neon paths (we won't care that autoconf says our neon is "too new"), and the original OSX version of Perl which has the really wacky library paths. Thankfully, OSX also is smart enough to put our libraries in the right spots. Change directory to the Subversion download, untar, and run the following
Like Git, we'll put it in /opt/local. That will fill out any of the problems we were having with the Perl libraries being in the wrong place (or not existing at all). You could try to install Perl 5.8 from ports as well (in fact, trying to install subversion-perlbindings forces it), but every time I had two sets of Perl on OSX, things got a bit strange. Once complete, you can test your install with
In response to "Git-Svn on OSX":