[Updated July 2014]
If you have built Git from source on Mac OS X you probably didn’t have much trouble. That is, unless you were trying to also build the documentation, in which case you probably ran into problems, right? I’m guessing it happened somewhere around getopt, gettext, or some other library or tool you didn’t have installed. And after several attempts to get the nth dependency to build you gave up. Look no further, as these steps will build Git and its documentation on Mac OS X, at least as of today.
This guide was mostly inspired by Setting up the Git documentation build chain on Mac OS X Leopard which was mostly correct at the time it was written, I assume. As of today it’s missing a couple of steps and it deserves an update for the latest Mac OS X and its libraries.
So without further ado, here are the steps.
Install AsciiDoc using the usual
sudo make install, which you probably did already since this one is easy.
Installation of gettext, used to be difficult, but now the usual
sudo make install works. Hurray for progress!
Download getopt, extract the tarball, open the
Makefile in an editor and add
-lintl to the
LDFLAGS variable (as described in the original Wincent wiki), at which point
sudo make install should work.
$ sudo mkdir -p /usr/local/share/docbook $ cd /usr/local/share/docbook $ sudo tar jxf ~/Downloads/docbook-xsl-1.78.1.tar.bz2 $ sudo unzip ~/Downloads/docbook-xml-4.5.zip -d docbook-xml-4.5 $ sudo mkdir /etc/xml $ sudo xmlcatalog --noout --add nextCatalog '' \ file:///usr/local/share/docbook/docbook-xsl-1.77.1/catalog.xml --create /etc/xml/catalog $ sudo xmlcatalog --noout --add nextCatalog '' \ file:///usr/local/share/docbook/docbook-xml-4.5/catalog.xml --create /etc/xml/catalog
Install Docbook2X which apparently wasn’t necessary when the Wincent page was written.
$ ./configure $ make $ sudo make install $ cd /usr/local/bin $ sudo ln -s docbook2texi docbook2x-texi $ sudo xmlcatalog --noout --add nextCatalog '' \ file:///usr/local/share/docbook2X/xslt/catalog.xml --create /etc/xml/catalog
Install xmlto by first ensuring that
/usr/local/bin is in your
sudo vi /etc/paths may help). Now the usual
sudo make install and you are nearly there.
Install Git, finally!
$ ./configure $ make all doc info $ sudo make install install-doc install-html install-info
At this point you should have a freshly built Git in
/usr/local along with all of the documentation. Hurray! If that doesn’t work for you, feel free to write to me. I would like to keep these instructions up to date as best I can.
If you happen to have installed a version of iconv in
/usr/local, you may experience some problems along the way when building Git and its documentation. If so, check out post from July 2014 that attempts to resolve this issue.