Wednesday, October 31, 2007

Git/git-svn on Mac OS X Tiger (Macbook)

Though Git is complex to use I hope it will solve most of my version merge problems. I have used svk (a distributed version tool written in perl built on top of SVN and the SVN perl bindings) before and it is easy to use after creating a basic workflow (which may be slightly hard for a novice svn or CVS user). Unfortunately it dies with complex merge situations. It happens mainly if there is too much reorganization in the main trunk compared to your local branch. For example I worked/work (i try to work whenever I can but always get stupefied by the merge issues.) on an open source project called Cosmo - now renamed as Chandler server - it is actively developed and the trunk undergoes a huge change quite often. The merge interface of svk was really nice and I used it to keep merging changes from the trunk to my local branch. I also had my local branch merged to my own svn sandbox so that if my system crashes I can restore using my svn sandbox :). My entire workflow is documented at

Now I got my almost new Macbook (repaired using Apple support) without any Linux (as of now) - I thought I will have most of the unix OSS goodies using Macports and Fink :). Git was one of my most wanted tool and I thought of installing it soon to get started with a few projects. As some of the websites pointed git install did not work using fink.
I did
# fink install git
and was greeted with some dependency error messages. I also tried
#fink selfupdate
asking me a lot of questions and taking a lot of time :(

#fink install git
again some dependency error message :(.

I always heard of Macports and wanted to give it a try. But installing Macports required installing XCode available through ADC, which requires a login. I first installed Macports without installing XCode hoping that it will work, but later realized that Macports needs a compiler as does any port based system. I have used Gentoo port based system and understood that everything is built using source and thus will require a compiler.

I downloaded the 3.0 version of XCode, but found that XCode 3.0 does not work with OS X 10.4 Tiger and is meant for leopard. I then downloaded the 2.5 version (around 1 GB download size) and installed it successfully. I could then issue port commands :)

# sudo port selfupdate

#sudo port install git-core

printed lot of stuff like downloading, building, etc taking a lot of time for the compilation
and Installation was a success :)

Happy with the success I typed
# git
it showed me the usage
I then typed
It said the command could not be found :(. A google search of git-svn on Mac showed me to use the command:
#sudo port install git +svn

That fetched a few more files, did some compilations, installations taking lots of time and I got an error that git-core is already installed. Obviously! But I wished the system was smarter and just installed git-svn.
I tried
and was greeted with the same command not found error.
I did see that the port system had two entries for git and I had to uninstall all git-core
# sudo port uninstall git-core @
# sudo port uninstall git-core

Then I did a
#sudo port install git +svn

I tried
and yes I did see it was installed but the perl module had some missing dependencies. The module called I searched that package in port - but it was of no use and so I tried CPAN.
# sudo perl -MCPAN -e 'install Error'

It asked me a lot of questions - some missing programs which I installed either using fink or port. Both taking a lot of time and thus patience.
# sudo port install lynx
# sudo fink install wget
The path for port based installations was /opt/local - so I had to specify /opt/local/bin for the path of lynx binary.
For fink the path is /sw/ - so I had to specify /sw/bin for the path of wget binary.

You could use a single package management system to install the packages. I tried fink thinking that it was more like apt-get - but no it was getting all the deb's but I think they are source debs since I could see the output of configure, make.

The other package required by CPAN was ncftpget - both fink and ports did not have those packages :(. I just skipped that step.
Then I needed ncftp - ports had the package - So I did a
# sudo port install ncftp
and the next one
# sudo port install gpg-agent
But that did not give me the gpg binary and there was no gpg package in the default macports :(. I just skipped all the questions by pressing enter continuously. I got the module installed :).
I then got an SVN/ not found error when I tried to run git-svn.

I first tried setting the PERL5LIB to my macports version of svn perl library and I got some weird error regarding some core bundler dependency. After struggling a bit I finally removed all git and svn from both Macports and fink. Downloaded git from - compiled and installed it the unix way :)
# wget
# tar -jxvf git-
# cd git-
# ./configure --prefix=/usr
# make && sudo make install

I followed and downloaded the svn package precompiled with all the language binding. After installing the dmg file, I had to set PERL5LIB to /usr/local/lib/svn-perl.

I got git-svn working finally :).

I still miss the apt-get based installation in Debian systems which just installs the binary and is very fast. Ofcourse port based system has its own benefits like better optimized binary, etc - but it would be really frustrating to wait for 1-2 hours for a program to be installed :(.

Apple support

I recently had some issues with my Macbook and I am impressed with apple support - only disappointment was they had to ship my Macbook to Apple factory and get my Macbook repaired. I had to register for some Geniusbar appointment in Apple website and had to drive to the store. I went to Palo Alto apple store which is the nearest Apple store for me and I was greeted by a good support staff. I found the support guys to be really smart and very crisp compared to any other support I have dealt with. They immediately found out the issue is not resolvable by them and they have to send the Macbook to the factory for repair. I was told that it will take 10 days for the entire process and everything will be covered under waranty :). They replaced my hard drive, RAM and the case which was broken slightly. I handle my Macbook with great care and still the case developed a small hole by itself :(. Thanks to Apple support they replaced my case with a new one and I am happy about that :). They also replaced my Airport network card for some reasons - don't know why - it was working perfectly! Their online tracking system also updates me on the status of the repair and told me when it was shipped overnight.
Overall I am happy that my Macbook is working again now :).