Installing Git on Mac OS X
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.
8 Comments »
RSS feed for comments on this post. TrackBack URL
Works fine on Leopard!
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.
The man pages don’t seem to work on my Leopard. Ideas?
@ 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.
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.
[...] Install git. [...]
[...] If you are using OS X I recommend you check out Djief’s blog to learn how to install Git on OS X. [...]
If you get:
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.
you need to update your Xcode: http://www.versiontracker.com/dyn/moreinfo/macosx/21437