Upgrading Git on Mac OS X 5

Posted by Colin A. Bartlett Sat, 07 Mar 2009 13:11:00 GMT

We recently switched to git based capistrano deployments and I quickly found out that these weren’t working from my MacBook Pro. I noticed that my git version was a few behind my coworker’s, so I figured it was time to upgrade.

Following Justin’s original git compilation instructions, I downloaded and compiled the latest Git version, 1.6.2 like so:

curl -O http://kernel.org/pub/software/scm/git/git-1.6.2.tar.gz
tar jxvf git-1.6.2.tar.gz
cd git-1.6.2
make prefix=/usr/local all
make prefix=/usr/local test && echo $?
sudo make prefix=/usr/local install

When the compile was done, it gave me output like this:

!! You have installed git-* commands to new gitexecdir.
!! Old version git-* commands still remain in bindir.
!! Mixing two versions of Git will lead to problems.
!! Please remove old version commands in bindir now.

Thanks to this nice posting, I discovered this always happens when you upgrade to 1.6 and above. Git now only puts the main git binary and a few others in your /usr/local/bin and it tucks the rest away elsewhere. That meant that all the other zillion binaries needed to be deleted from my bin. I simply did:

cd /usr/local/bin/
ls -latr | grep git

Which gave me an ordered list of all the git binaries installed. The ones at the end all had today’s date on them, so I knew those were the new versions. The rest I could whack. The ones I could keep were git-upload-pack, git-upload-archive, git-receive-pack, git, git-shell, git-cvsserver, and gitk. The rest I removed like so:

sudo rm git-var git-update-server-info git-unpack-file git-ssh-upload git-ssh-push git-ssh-pull git-ssh-fetch git-show-index git-send-pack git-peek-remote git-patch-id git-pack-redundant git-mktree git-mktag git-merge-tree git-merge-recursive git-merge-index git-local-fetch git-index-pack git-imap-send git-http-push git-http-fetch git-hash-object git-fetch-pack git-fast-import git-daemon git-convert-objects git-bisect git-write-tree git-whatchanged git-verify-tag git-verify-pack git-update-ref git-update-index git-unpack-objects git-tar-tree git-tag git-symbolic-ref git-svnimport git-svn git-submodule git-stripspace git-status git-stash git-show-ref git-show-branch git-show git-shortlog git-sh-setup git-send-email git-runstatus git-rm git-revert git-rev-parse git-rev-list git-reset git-rerere git-request-pull git-repo-config git-repack git-remote git-relink git-reflog git-rebase--interactive git-rebase git-read-tree git-quiltimport git-push git-pull git-prune-packed git-prune git-parse-remote git-pack-refs git-pack-objects git-name-rev git-mv git-mergetool git-merge-subtree git-merge-stupid git-merge-resolve git-merge-ours git-merge-one-file git-merge-octopus git-merge-file git-merge-base git-merge git-mailsplit git-mailinfo git-ls-tree git-ls-remote git-ls-files git-lost-found git-log git-instaweb git-init-db git-init git-gui git-grep git-get-tar-commit-id git-gc git-fsck-objects git-fsck git-format-patch git-for-each-ref git-fmt-merge-msg git-filter-branch git-fetch--tool git-fetch git-diff-tree git-diff-index git-diff-files git-diff git-describe git-cvsimport git-cvsexportcommit git-count-objects git-config git-commit-tree git-commit git-clone git-clean git-citool git-cherry-pick git-cherry git-checkout-index git-checkout git-check-ref-format git-check-attr git-cat-file git-bundle git-branch git-blame git-archive git-archimport git-apply git-annotate git-am git-add--interactive git-add gitjour

Then I just had to go back and install the manpages for the new version like so:

curl -O http://kernel.org/pub/software/scm/git/git-manpages-1.6.2.tar.bz2
sudo tar xjv -C /usr/local/man -f git-manpages-1.6.2.tar.bz2

And, low and behold, I was now running git 1.6.2! What’s more, my capistrano deployments work now.

Comments

Leave a response

  1. Avatar
    Pieter about 1 hour later:
    Yeah, or just install macports and do a 'port upgrade git-core', problem solved
  2. Avatar
    Colin about 1 hour later:
    @Pieter I had all kinds of problems trying to install from MacPorts. Plus, compiling is more fun. =)
  3. Avatar
    cheapRoc about 3 hours later:
    To each his own... honestly, years ago I ran Fink and Macports and I didn't like waiting for someone else to generate a binary package I could just as easily do myself. Try applying a security patch to a Macports bin. :/

    I used to have no idea where anything was too. Now I can either install things into their own dir's under /usr/local (/usr/local/rubinius, etc) or install them directly into /usr/local. I'm sure you can do this with ports but again, I run beta/alpha/experimental stuff sometimes.

    When I redo my laptop or OS X install, I just copy over my old /usr/local. I have no clue what /opt is.

    I read source, I tinker with source and I get paid to write source. I want the source code handy on my development machine for when I want to know how these things work or I want to extend them myself.

    Now on a production machine I would love to handle packaging myself, with my own package server. But most of the time that's not necessary/worth the time so Ubuntu generally keeps current enough.

    Final remark on the subject. I'm sure I could use the arrow keys in Emacs, but I'm much faster using C-n, C-p, C-f and C-b.
  4. Avatar
    Keith 1 day later:
    another option, a bit less involved: sudo rm -f /usr/local/bin/git* sudo make prefix=/usr/local install As the t-shirt says, "Kill 'em all--let God sort them out."
  5. Avatar
    Andy 5 days later:
    So macports is not a binary distribution mechanism. Think gentoo or freebsd. When you install via macports, you are compiling, only passively. I too had problems with macports, but it had everything to do with not understanding it. The macports system provides a ton of value to me. There are so many tools I need that OSX just does not provide. For my money sudo port install git-core +svn is where it's at. With this you get git-svn, which is pretty important in a world where not everyone is enlightened to the ways of git.
Comments