Mac OS X

Git on Mac OS X

The latest Git works swimmingly on the Mac. To download it you can curl it from the repository:

curl http://kernel.org/pub/software/scm/git/git-1.6.5.3.tar.gz -O

Next, extract the files:

tar xzvf git-1.6.5.3.tar.gz

Once extracted, cd into the directory that you extracted the files into and then run a make configure with the git-1.6.5.3 directory as your working directory.

make configure

If you cannot run make becuase you don’t have a compiler, make sure that you have installed the developer tools on your computer. Once you have run the make, run the configure, specifying the directory you would like to install into. In this case I’ll be deploying into /usr/local/git:

./configure –prefix=/usr/local/git NO_MSGFMT=yes make prefix=/usr/local/git all

Now run a make install to complete the installation:

make install

Once git has been installed, let’s look at the global options and choose which ones to configure:

git config –global –list

The first setting you’ll typically want to change is the name that git uses. To set your name use the git config again, but specify the –global option and then the setting (in this case user.name) following by the actual name you would like to use (in my case it’s Charles Edge):

git config –global user.name “Charles Edge”

Next, use the user.email setting to set your email address:

git config –global user.email “cedge@318.com”

Now that you know how to customize options, check the global options list and change any remaining that you would like to set. Once done, let’s grab the man pages. To install the man pages, first curl them down:

curl -O http://kernel.org/pub/software/scm/git/git-manpages-1.6.5.3.tar.gz

Then extract the man pages into your /usr/local/share/man directory (or wherever you like to keep them):

tar xjv -C /usr/local/share/man -f git-manpages-1.6.5.3.tar.gz

If git is already installed you can obtain the version information by running git with a –version option:

git –version

Now let’s grab the html docs:

curl -O http://kernel.org/pub/software/scm/git/git-htmldocs-1.6.5.3.tar.gz

And then let’s put them in /Library/WebServer/Documents:

tar xjv -C /Library/WebServer/Documents -f git-htmldocs-1.6.5.3.tar.gz

You should now be able to use git.