Note: These instructions are for Mac OS 10.4. I don’t know if they’ll work with Leopard.

Installing git is easy, just compile from the source. Git svn is harder to install because it is a bunch of perl scripts that needs the svn perl bindings (it comes with git btw). Here are the steps I recommend to make sure everything works.

First, we’ll install git using Macports. This will take care of installing all the required perl libraries:

$ sudo port install git-core +svn

However, macports installs a slightly old version of git. So I suggest downloading the latest and compiling from source.

$ sudo make install
 # Note: watch out for the way your PATH is setup
 # to make sure you are using this new git version
 # instead of the macports version
$ git --version

Now if you try to run git svn, you might get an error about it not finding SVN/Core.pm. That means your version of subversion does not include the perl bindings (which is the standard if you installed svn with macports). I suggest you install subversion from this package that includes the language bindings. Now you need to add this to your ~/.profile:

export PERL5LIB=/usr/local/lib/svn-perl

Everything should work. Now it’s time to import your svn repositories and enjoy git.

Popularity: 29% [?]

 

8 Responses to Installing Git on Mac OS X

  1. Dan Croak says:

    Grrrr… I got the following error messages on Leopard:

    Error: Target org.macports.fetch returned: fetch failed
    Error: The following dependencies failed to build: p5-svn-simple subversion-perlbindings apr apr-util db44 sqlite3 readline ncurses ncursesw gettext neon subversion p5-term-readkey
    Error: Status 1 encountered during processing.

  2. Carl Mercier says:

    The man pages don’t seem to work on my Leopard. Ideas?

  3. jfcouture says:

    @ Carl: I personally did not install the man pages. It seems to require more effort than it’s worth:
    http://wincent.com/knowledge-base/Setting_up_the_Git_documentation_build_chain_on_Mac_OS_X_Leopard

    @Dan: I have a coworker getting the same error on Tiger. I think it’s related to a prior installation of perl with macports. Unfortunately, I don’t know how to fix it yet.

  4. Carl Mercier says:

    Wow thanks for the link! I’ll have to give this a shot as I’m not quite a GIT expert yet. Can’t wait to see your presentation at MoR. Looks like a lot of people are as anxious as me from what I hear on the street.

  5. [...] If you are using OS X I recommend you check out Djief’s blog to learn how to install Git on OS X. [...]

  6. Thomas says:

    Thanks a lot for the hints. It’s still valid on Mac OS X Lion. Here’s what I had to do in order to convert an existing svn repository into git:


    sudo port install subversion-perlbindings
    sudo port install git-core +svn
    sudo gem install svn2git

    (assuming macports is installed)

    Then I was able to run svn2git to do all the magic.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>