Geekish Stuff

Git plus Perl 5.10 with MacPorts on Mac OS X Leopard

Date published: 31-Mar-2008
1 min read / 197 words
Author: braceta


So today I've been struggling with MacPorts in order install Git with Perl 5.10 and not perl 5.8 (since I have already installed Perl 5.10 and I don't want two different version of Perl in my system). After reading something about it I came up with a simple solution by overriding the Portfile from the Macports installation. Its easy as:

  1. Edit your /opt/local/etc/macports/sources.conf and place the following line on top of the file:
file:///Users/< your username here >/.ports/ [nosync]

this will make ".ports" directory the local repository for the MacPorts.

  1. Create directory structure for "git-core" package:
$ mkdir -r /Users/< your username here >/.ports/devel/git-core
  1. Download the Portfile for git-core into the created dir:
$ cd /Users/< your username here >/.ports/devel/git-core
$ wget
  1. Change the runtime dependency from perl5.8 to perl5.10 by editing the file Portfile and changing the depends-run directive. It should look like:
depends_run port:openssh port:rsync port:perl5.10 port:p5-error

Also remove the patchfiles directive because the patch does not exists anymore:

patchfiles patch-Makefile.diff patch-http.h.diff
  1. Run the portindex command in ".ports" dir. You will be presented with an output like:
Creating software index in /Users/Braceta/.ports
Adding port devel/git-core
Total number of ports parsed: 1
Ports successfully parsed: 1
Ports failed: 0
  1. Now install the "git-core" normally as you usually do, but now the dependency is fixed:
$ sudo port install git-core

If you look at the steps here you can also learn more from the MacPorts packaging system and override other package definitions it you want to! Hope it helps :).