Installing Git on OS X Leopard
It’s apparently best to install Git using both MacPorts and from source. That way you’ll get all the dependencies that are a pain in the ass to get set up, and you’ll also get the newest version of Git.
If you haven’t already, stick your Leopard disk in and install Xcode 3.0.
Install Git + Dependencies from MacPorts
Install the MacPorts “Leopard (Universal)” disk image from here.
If after the installation, running which port doesn’t show /opt/local/bin/port, try adding the following lines above any other path rules you have in your .bash_login file:
# MacPorts
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH
# / MacPorts
Make sure MacPorts is up-to-date:
sudo port -v selfupdate
Install Git:
sudo port install git-core
Install Git from Source
Go to git.or.cz and download the newest package.
Stick the file where you want it (I prefer /usr/local/src/).
Open the file and cd into its folder. Then:
sudo make prefix=/usr/local all
(You won’t need the sudo on the last command unless you’ve got your source in /usr/local/src/, which is owned by root)
Then:
sudo make prefix=/usr/local install
If everything goes as planned, you should be able to type which git and see exactly this:
/usr/local/bin/git
If instead you see /opt/local/… you’re using the MacPorts version and you need to move those path rules above the other rules in your .bash_login.
Enjoy.
Bonus: TextMate Integration
To use TextMate to edit your commit messages, put the following in your ~/.bash_login:
export GIT_EDITOR="mate -w"
Install the TextMate Bundle:
mkdir -p /Library/Application\ Support/TextMate/Bundles
cd !$
git clone git://gitorious.org/git-tmbundle/mainline.git Git.tmbundle
osascript -e 'tell app "TextMate" to reload bundles'
Since Git is installed in /usr/local/bin, you’ll need to make a link to where the bundle expects it:
sudo ln -s /usr/local/bin/git /usr/bin/git
Comments
Even more of a bonus: Geoff Cheshire and I have been putting together some Git installer packages for OS X:
http://code.google.com/p/git-osx-installer/
Additionally, for some really great textmate integration:
http://gitorious.org/projects/git-tmbundle/
Thanks for the writeup. If you’re interested in hosting git on your leopard machine, then I’ve written a writeup over at blog.ardes.com
Interesting, especially the compiling from source. I also wrote about Git on OS X some time ago with a little more focus on the installation from MacPorts and Configuration. You can find it here
[...] directions posted here worked fine for me to upgrade my existing source based installation in [...]
Thanks so much for these incredibly easy-to-follow, accurate instructions. Everything worked exactly as it was supposed to with no errors, which is pretty much a first for me.
Somehow, someway, I lost my Git man pages during the upgrade. Doh!
In case anyone else ends up in the same boat, these two commands will install the 1.5.6 man pages and get you back on track:
[...] Installing Git on OS X Leopard(MacPorts) [...]
Thanks for the solutions log Trey! For the Macports version of the install you probably want to have xcode installed. To ease the pain.
Added that to the post. Thanks, McCall.
What do you think about that?