Saturday, April 5, 2008

Git OS X installer is official

Between mine and Geoff's efforts, we've finally reached a point where the Git OS X Installer is deemed "stable", and has now become an official source on Git's home page. There were a few major hurdles along the way:

HURDLES & SOLUTIONS:


HURDLE: Ruby script to update PATH and MANPATH failed on some machines

SOLUTION:

  • Convert script to bash. Ruby was less than reliable, due to the inability to predict where it was installed.

HURDLE: Binaries still referencing libs from Darwin Ports, instead of the libs we've bundled with the installer.

SOLUTION:

  • Add NO_DARWIN_PORTS=1 to the top of the Makefile
  • Put LDFLAGS="-L/usr/local/git/lib,/usr/lib" in the arguments for each of the make commands

HURDLE: Package installer size was whopping 40MB download, and 89 MB to install:

SOLUTION:

  • Converted the 80+ hardlinks (git-branch, git-remote, etc.) to symlinks. The OS X PackageMaker just doesn't respect hardlinks and was treating them all as individual duplicates of a file.
  • Stripped binaries of debug symbols after compiling via "make strip"

CONCLUSION

Now, the package has worked very well on machines that don't have the developer tools installed. The download size is 3.6 MB (instead of the original 40 MB), and it takes 9 MB to install, instead of 87 MB. That's pretty great progress in my eyes! And considering the fact neither Geoff or I have built a package for OS X before, it's a reasonably great accomplishment.

There are a few minor glitches still happening:

  • On some machines, it complains about not being able to create "/". This error does not mean git wasn't installed successfully, but it may mean that you need to download this script and run it manually, yourself. (or, set PATH and MANPATH in your environment to include /usr/local/git/bin and /usr/local/git/man, respectively)
  • Unless you launch Git GUI from the shell, it fails on fetch / push / clone over the network. You can use the "Open in Git Gui" droplet to help overcome this.

Download Git for OS X

7 comments:

Charmed said...

Awesome work. Thanks so much for taking the time to make it easier for the rest of us to get on the git train!

Si said...

Great stuff. I just used your build recipe to build Git v1.5.5.

I skipped the steps "sudo UserScripts/cplibs.sh" and "mkdir -p /usr/local/git/man" as I already had your 1.5.4.5 package installed, and changed the version numbers throughout - it was smooth sailing!

Cheers Tim!

ocean said...

Hi Tim,

I installed Git on OS X 10.5.2 using your installer the other day, and found a couple of little issues which I thought you might like to know about.

Firstly, the installer over-wrote my ~/.bash_profile file when it added the PATH and MANPATH vars, instead of appending them. I lost the aliases that were in there, but there were only a couple, so it wasn't really a problem for me, but could be for others.

Secondly, the installer also left the 3 post-install scripts sitting in my / directory - I would have though it better to have removed them after installation was completed?

I do have the OS X Developer Tools installed, I see you mentioned that in the post - perhaps that has something to do with it?

Cheers,
Drew

Tim Harper said...

Hi Ocean:

This is a late response, but your feedback has been a great help in improving the installer. These issues should have been completely resolved by now. I really didn't know what I was doing when I first started building the packages. Thanks to the feedback you all have given, I'm a bit smarter now.

Matt Di Pasquale said...

Hi Tim,

I installed git with the git installer. It works great.

I tried to see how you guys built it by reading the source code.

what is: FROM_DIR="/opt/local/lib/"

I don't have an /opt directory. i'm using the newest macbook 2.4ghz. just got it.

also, does the builder just build the .dmg file? or does it reinstall git on my machine?

how do i uninstall git?
if I delete the folder here: /usr/local/git, and I delete the git files here /etc/paths.d and here /etc/manpaths.d, then will git be completely uninstalled? or were there other changes made by the installer?

thanks!

Matt Di Pasquale said...

oh. i did:
sudo find / -xdev -name "libexpat*" -print

and I found:
/usr/lib/libexpat.1.5.0.dylib

in /usr/lib i also see:
libcrypto.0.9.7.dylib
libz.1.2.3.dylib
libssl.0.9.7.dylib

so should i change opt to usr?

also should i change the version numbers to match the ones i have?

Tim Harper said...

Hi there Matt!

Yes, you are correct on how to uninstall it - /usr/local/git*, and /etc/paths.d/git, /etc/manpaths.d

As for the opt directory, that gets put there by ports.

For more info on how to build it, resort to a screencast I put together a while ago:

http://git-osx-installer.googlecode.com/files/HowToBuildGitInstaller.mov.zip

Thanks!