Tim Dysinger RSS

Dec
30th
Sun
permalink

Installing GIT on Mac OS X 10.5 Leopard

Update: Tim Harper points out in the comments there is now a fairly up to date OS X installer at google code if you would rather not deal with building it yourself. Easy! (You'll still want to do the configuration part at the end of this article, though, using the scripts starting at "alias g") Here's how I compiled Git source control on OS X Leopard.
# GPG (if you didn't have it already)
curl ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.7.tar.bz2  tar xj
cd gnupg-1.4.7
./configure
make
sudo make install
cd ..

# GetText
curl http://mirrors.usc.edu/pub/gnu/gettext/gettext-0.17.tar.gz  tar xz
cd gettext-0.17
./configure
make
sudo make install
cd ..

# GIT
curl http://kernel.org/pub/software/scm/git/git-1.5.5.tar.bz2  tar xj
cd git-1.5.5
./configure
make
sudo make install
cd ..
curl  http://www.kernel.org/pub/software/scm/git/git-manpages-1.5.5.tar.bz2  \
sudo tar xj -C /usr/local/share/man

# alias "g" for "git"
cat >> ~/.profile << \EOF
alias g='git'
export PS1='$(git branch &>/dev/null; if [ $? -eq 0 ]; then \
echo "\[\033[00m\]$(git branch  grep ^*sed s/\*\ //) "; fi)\$\[\033[00m\] '
EOF
source ~/.profile

# you
git config --global user.name "Mr Man"
git config --global user.email "mr@man.com"

# colors

git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
git config --global color.interactive auto
# shortcuts git config --global alias.st status git config --global alias.ci commit git config --global alias.co checkout git config --global alias.br branch # if you ever have conflicts you can type git-mergetool # to use Apple opendiff (FileMerge) for resolving conflicts git config --global merge.tool opendiff # Whenever we merge provide a summary of commits git config --global merge.summary true # globally ignore some cruft files git config --global core.excludesfile ~/.gitignore echo "*~" >~/.gitignore echo ".DS_Store" >>~/.gitignore # setup nice fonts on gitk cat >~/.gitk <<\EOF set mainfont {Monaco 10} set textfont {Monaco 10} set uifont {Monaco 10} EOF
Also check http://git.or.cz/gitwiki/GitTips for more tips.