Archive for the 'Uncategorized' Category

Compiling Git and git-svn on OSX Tiger

Saturday, December 29th, 2007

Getting Git to work properly with a package manager is pretty easy, but after having been through package version hell I only compile things now.

While compiling is normally an easy configure/make/install cycle, you do get the occasional dependency hell. Unfortunately, Git on Tiger is one such situation.

The following worked for me to get Git, Git’s man pages, and git-svn working on OSX Tiger.

First cd to wherever you keep your source files (remember to adjust this path in all the following instructions if yours is different):

cd /usr/local/src

Next lets install an XML parser dependency, Git, and it’s man pages:

curl -O http://surfnet.dl.sourceforge.net/sourceforge/expat/expat-2.0.1.tar.gz
tar xvzf expat-2.0.1.tar.gz
cd expat-2.0.1
./configure --prefix=/usr/local
make
sudo make install
cd..

curl -O http://kernel.org/pub/software/scm/git/git-1.5.3.7.tar.gz
tar xvzf git-1.5.3.7.tar.gz
cd git-1.5.3.7
./configure --prefix=/usr/local
make
sudo make install
cd ..

curl -O http://www.kernel.org/pub/software/scm/git/git-manpages-1.5.3.7.tar.bz2
sudo tar xjv -C /usr/local/man -f git-manpages-1.5.3.7.tar.bz2

Add the following environment variable to whatever file your shell uses (.bash_profile for BASH):

export MANPATH="/usr/local/man:$MANPATH"

Whew, you now have Git! One cool thing it comes with is git-svn, which let’s you work with existing Subversion repositories. Unfortunately this does not work immediately on Tiger, and you might get an error like Can't locate SVN/Core.pm in @INC when trying to use it. Aw shucks… brave on to use git-svn soon!

First find your existing Subversion source directory, and compile some Perl modules you probably skipped originally:

cd /usr/local/src/subversion-1.4.3
make swig-pl
make check-swig-pl
sudo make install-swig-pl

At this point you can use git-svn, except when dealing with an authenticated repository. The error will look like this Can't locate Term/ReadKey.pm in @INC, but we can fix that too. We will now connect to Perl’s CPAN (if this is your first time, just answer the questions it asks… I mostly hit enter or typed “yes” for everything) and then install something necessary to take your authentication credentials input from the command line:

perl -MCPAN -e shell
install Term::ReadKey
exit

Tada, after quite a journey you are ready to start moving away from Subversion with Git and finally achieve branching nirvana! Let me know if you have any problems in the comments.

Many thanks to Justin Reagor and Rudolf Heuser for their tips.