This is a ‘note to self’ about Git and how to build and install on Mac OS X and how to install on Windows.
Building and Installing Git on Mac OS X (specifically 10.5 Leopard)
I haven’t been won over by Fink or MacPorts. There is the git-osx-installer project on Google Code which provides a DMG. But I’m comfortable with Makefiles and I have the Developer tools installed, so I build and install from the source.
Here are the steps I follow:
- Get the ‘latest stable GIT release’ from http://git-scm.com/. As of this post the latest stable Git release was v1.6.1. Get the tar.bz21 file, for example:
git-1.6.1.tar.bz2
. - Unpack the tar file. I have a
~/Projects
directory. In the Finder I typically move the tar file to~/Projects
and then double-click the tar. The Mac OS X 10.5 Archive Utility will handle the file.git-1.6.1.tar.bz2
will be unpacked into a directory namedgit-1.6.1
.
From the command line the tar command would be something like:tar xjf git-1.6.1.tar.bz2
- I want to install Git to
/usr/local
. I also want to be able to easily mange new Git installs and Git has lots of parts so I create a subdirectory for Git in/usr/local
.- Create a directory in /usr/local for the Git release, for example:
sudo mkdir /usr/local/git-1.6.1
- Create a subdirectory for the Git release man pages, for example:
sudo mkdir /usr/local/git-1.6.1/man
- If this is the first install of Git on the machine, create a symbolic link to the release directory:
sudo ln -s /usr/local/git-1.6.1 /usr/local/git
Going forward,/usr/local/git
should always link to the release you currently want to use. - Add
/usr/local/git/bin
to your PATH. - Add
/usr/local/git/man
to your MANPATH.
- Create a directory in /usr/local for the Git release, for example:
- Change directory into the unpacked source code, for example:
cd ~/Project/git-1.6.1
- Configure the build. Set the prefix to the directory the release should be installed into. For example:
make configure
./configure --prefix=/usr/local/git-1.6.1
- Build Git.
make
- Install Git.
sudo make install
- Don’t bother building the man pages. Get the matching man pages tar from http://kernel.org/pub/software/scm/git/.
For example:
git-manpages-1.6.1.tar.bz2
.From the command line, unpack the tar into the install location, for example:
sudo tar xjf git-manpages-1.6.1.tar.bz2 -C /usr/local/git-1.6.1/man
- If needed, update the
/usr/local/git
symbolic link.
Resources for Git on Mac OS X:
Hivelogic - Installing Git on Snow Leopard
Compiling and installing git on Mac OS X - Guides - GitHub
Compiling Git for Mac OS X Leopard (10.5)
A Funkaoshi Production :: Building Git on Mac OS X
Windows
I don’t build from scratch on Windows. I’m currently trying out the msysgit package from Google Code.
1The bzip2 compression is more efficient than the older gzip compression.
Comments