Compiling Git and git-svn on OSX Tiger

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.

16 Responses to “Compiling Git and git-svn on OSX Tiger”

  1. Kevin Russell Says:

    Thanks so much for the help!!! I just wanted to add one more tip on something that tripped me up. Make sure to have swig installed.

  2. Gitting git-svn working on mac « RubyHam Says:

    […] problem was getting git-svn to work. Despite the numerous posts including: post1 post2 post3 and post4 I absolutely could not get it to work. Finally, here are two techniques that worked for […]

  3. cc Says:

    thanks a lot, saved me time

  4. Blaine Says:

    Note to add:
    to install via fink:

    $ sudo fink install git
    $ sudo fink install svn-swig-pm586

    Thanks for the tip on ’swig-pl’! :) I didnt know what I was looking for.

    OS 10.4.11 Tiger

    Blaine

  5. Steve Says:

    Awesome! Thanks so much. Saved me a huge amount of pain & time.

  6. Joe Says:

    Thank you!

  7. Mike Says:

    Me too–thanks!

    [Found you on Google re: “git os x tiger.”]

  8. RAILS66 » Blog Archive » Installing Merb Says:

    […] Compiling Git and git-svn on OSX Tiger […]

  9. Using Git on Rails project | ArvinderKang.com Says:

    […] Steps I took to install Git on OS X Tiger server are as follows (Thanks to LarrytheLiquid): […]

  10. Tim Harper Says:

    Reliable Git OS X installer packages are available here, if you’d like to skip the hassle and just install git:

    http://code.google.com/p/git-osx-installer/

    Tim

  11. Installing GIT on OSX Tiger | SydneyFX - A Web Designer Blog Says:

    […] but it is recommend to compile your own from source so you get the latest version. Check out this guide to installing GIT on OS X Tiger. […]

  12. Adam Says:

    Nice!

    If you’ve installed git to a non-default location (i.e., use –prefix), you can install the subversion Perl bindings by doing

    cd [subversion-source-dir]
    cd subversion/bindings/swig/perl/native
    perl Makefile.PL PREFIX=/path/to/installation
    make
    make install

    after you’ve built subversion from source.

  13. Kfz Versicherung Says:

    I have bookmarked this informativ site. Thanks Kfz Versicherung

  14. mg Says:

    Hi,

    this was nice.
    thx.

  15. Installing Merb | CONNECT ME Says:

    […] Compiling Git and git-svn on OSX Tiger ????????????? Merb ???????????? gem dependency ???? […]

  16. kronn Says:

    If git and subversion are installed from binary, Perl still needs to find the missing Libraries.
    For SVN/Core you may need to extend the Perl5Lib-Variable by putting this into your ~/.profile:

    # needed for “git svn”
    export PERL5LIB=/opt/subversion/lib/svn-perl/

    Thanks for the right pointers!

Leave a Reply