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/ 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: 58% [?]


19 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.

    • IntAn says:

      I use SVN on all of my pocejrts. Most pocejrt I work on are of the one man nature. But having SVN allows me to sync files between locations. No guess work in what has changed.Gone are the days of I had that working but changed the code. because I can just diff the code with SVN to see what I changed.If you do work with a few other people then SVN really shines because it keeps track of who changed what and when. Just update your working copy and the changes are merged into yours. You can also Diff their changes with yours for code review.I have my three servers (dev, staging and live) setup with SVN working copies so I just need to update the live and staging sites to deploy a new version.I tag deployments so rolling back to a known working version is just a matter of moments not hours.Lastly I have my SVN server in another state so I have instant offsite backups.

    • Raden says:

      Micheal,Yes, Karen’s use of the word “possibly” is concerning and llikey not accurate. Your use of the word “rage” is concerning and not accurate. And while on the topic of word choices, the blog would read more clearly if Karen noticed the word “off” is spelled with two f’s not one.The concern and disappointment with disabling print preview is based on the fact it is rare over the past year for the Chrome team to disable core functionality features in the Beta Channel. The last instance I recall was temporarily disabling Flags.Certainly stability A-B testing and undisclosed security patch testing is better done in Beta than Stable Channel. And better communication on the part of Google blog writers would be helpful. But the core issue here is Google has typically resolved major bugs in the Dev Channel such that core functionality features usually do not need to be disabled in the Beta Channel. Shaders, 3D acceleration, and UI are understandable. Flags and print preview / cloud print are another matter.And when needed core features are not present, by default Chrome customers must use a competitor’s browser to keep work flow – flowing. That isn’t done out of protest but out of simple necessity.

    • Open says:

      “Please note that print preview will plbsisoy be turned back on in a future release.”Really ? Would you care to explain the reasoning behind this ? Print preview is an excellent feature, much better than system print box. If print preview is off how do we use the Google PDF printer or send to Cloud Print easily. A big error Google.

    • Did you ever one consider that maybe what you refer to as “dangerous partisan rhetoric ” is actually support for a system of beliefs in less government, lower taxes, and more personal freedom and responsibility? Then again, you welfare-loving libtards wouldn’t know anything about a belief system.If you did, you’d be out preaching what you believe in, instead of coming here and spewing your worthless liberal diatribe that no one cares to hear.

    • I don’t really like livejournal or xanga. I already have both of those. I was going to try deadjournal because I read on here that it was really good, but I don’t want to have to pay for it and you have to have an invite code to get in free. Does anybody have an invite code they could give me, or a suggestion on another free blogging website I could try? Any information would be helpful..

  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:

    @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.

    • Slava says:

      Subversion is a great starting point as prtety much every IDE has integrated tools for it and it’s quick and easy to setup. To be honest, you don’t have to adhere to any standard in folder structure or whatever just create a project folder and check it in or update it. Simple project back and snapshots. Don’t worry about versioning and alike for now, just use it like a backup tool simply doing that will lead to more advanced ways to use the data once it’s in there

  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.

    • Suzanne says:

      I am pro version cootnrl in a team environment and can see how it might not be necessary to use it when you’re a loan developer.I think for someone to make a broad statement like there’s “no excuse” not to have version cootnrl is a bit of a silly statement to make. What if you work for a client that doesn’t want you to use version cootnrl, should force them to use it on their server anyway? Silly people. : )

    • Rick says:

      Was accelerated 2D canavs really unstable enough for a dev build? I’ve had it enabled for a while on my Win7 64bit pc without a single crash.I could understand if this was a beta/stable release but this is a developer release and 2D canavs is not even a default, it has to be manually enabled.I noticed a slight slow down when opening chrome with 30~ pinned tabs. Oh well, hopefully it will be back next release.

    • Deniz says:

      To the guys who’re commenting in what aaepprs rage about Print Preview: I’m sure that they’ll add it back. It is possible that it was removed as they prepared to move the beta branch to the stable branch.I agree that the wording of “possibly” is concerning, but I don’t think the comments here are the appropriate place to voice those concerns.

      • Aarohi says:

        Isn’t even any new features in Chrome 7 from what i can see. I tughoht the point of the 6 week cycle was to get features to people faster. Looking at the number of features that keep getting bumped up repeatedly (side tabs, smooth scrolling, print preview etc.) i wouldn’t hold your breath for version 8 to have anything new either.

  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.

  7. [...] I learned about PERL5LIB variable from here. [...]

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>