Installing GIT on Mac with Macports

This small guide will help to install GIT on Mac using Macports.

Environment:

  • Mac Os X – Leopard 10.6.6
  • MacPorts 1.9.2

Start of the installation

$ sudo port selfupdate
$ sudo port install git-core

1st Problem

Error: Target org.macports.build returned: shell command failed (see log for details)
Error: Failed to install perl5.12

Perl5 is a compilation dependency, but somehow not declared, so install it manually:

$ sudo port install perl5

And again:

$ sudo port install git-core

2nd Problem

Error: db46 requires the Java for Mac OS X development headers.
https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20719

Interested in why this error comes up?

http://comments.gmane.org/gmane.os.apple.macports.user/22266

Apple’s most recent security update prior to Mac OS X 10.6.5 (presumably included in 10.6.5 also) deletes a
file that was previously part of the OS, and is now only part of that development package. We don’t know why
Apple made this change, only that db46 and a handful of other ports break without it, so we detect this and
advise you how to fix it.

Visit with the Apple page and fetch the development headers – be aware that you need an Apple-ID.

And again:

$ sudo port install git-core

Success!