Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Git on OS X

I am trying to install Git on Mac OS X Leopard. I'm trying to avoid the MacPorts/Fink route. I'm also trying to avoid the installer on Google because I've gotten very far on my own, but if I have to I'll go ahead and download the installer.

Anyway, I have Git installed. /usr/local/bin/git. The problem is that none of the documentation installed, and the Makefile never bothered to tell me that. So now I have Git sitting around waiting to be used as I try to install the manpages for it.

For some awful reason, the manpages are maintained as text files, which are to be processed by the AsciiDoc program, which I promptly installed. But AsciiDoc converts these text files to XML.

Then Git uses another program called xmlto to convert the XML that AsciiDoc spits out to manpages (I think - I haven't gotten that far yet). The problem is that I get this error whenever it starts that step (first line is output from make, rest is error):

    XMLTO git-apply.1
I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd
/Users/chrislutz/prog/sources/git-1.6.3.1/Documentation/git-apply.xml:2: warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
D DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"

So basically it just goes through every file and gives me that error for all of them.

I did try at one point to download the file http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd, put it in the directory, and then changed all the references in the XML files to the file in the directory, but this gave me more and stranger errors. If I got a regular solution to work, it might still give me those stranger errors, which means the whole thing is screwed and that I'll just use the Google installer.

However, I've gotten (stumbled) this far on my own, and I feel like this is one last step before a sigh of relief and the chance to use Git. So I want to make a last-ditch effort to understand what's wrong. And "last-ditch effort" means "Ask Stack Overflow."

So if anyone could give me any insight as to what that error means and why it's occuring (and what I might be able to do to fix it), that would be awesome. If not, I'll try the Google installer.

like image 521
Chris Lutz Avatar asked May 22 '09 11:05

Chris Lutz


People also ask

Is git already installed on Mac?

Git can be installed on the most common operating systems like Windows, Mac, and Linux. In fact, Git comes installed by default on most Mac and Linux machines!

Where is git installed Mac?

simply type in which git in your terminal window and it will show you exactly where it was installed.


2 Answers

I recently installed git-1.6.4.2 on CentOS 5.3. Building git was no trouble, but attempting to install the accompanying docs produced pain at every step. The versions of xmlto and asciidoc from the yum repos were old, so I built them from source. Then xmlto (by way of xmllint) complained about missing DocBook 4.5, and I finally managed to get those in manually.

Getting this far, the doc build trundles happily along until

    DB2TEXI user-manual.texi
/bin/sh: line 1: docbook2x-texi: command not found
make[1]: *** [user-manual.texi] Error 127

But docbook2x is installed! Ah, the command is different:

$ rpm -q --filesbypkg docbook2x | grep bin.\*texi
docbook2x                 /usr/bin/db2x_docbook2texi
docbook2x                 /usr/bin/db2x_texixml

Even trying to run it manually, I still find no joy:

$ db2x_docbook2texi user-manual.xml --encoding=UTF-8 --to-stdout >user-manual.texi++
docbook2texi:/book: no description for directory entry
/usr/bin/db2x_texixml:-::node: fatal error: node belongs to a different file
Died at /usr/bin/db2x_texixml line 959.

The bottom of INSTALL mentions a couple of handy make targets: quick-install-man and quick-install-html. It turns, for example, out that

$ make prefix=/usr/local quick-install-man

is equivalent to

$ ./Documentation/install-doc-quick.sh origin/man /usr/local/share/man

That has a couple of problems: we need a git repo to use these targets, and the heads of the man and html branches may not correspond to the version you're installing.

So, a quick-and-dirty bootstrap:

tar xfz git-1.6.4.2.tar.gz
cd git-1.6.4.2
make prefix=/usr/local all
sudo make prefix=/usr/local install  # (1)

cd ..
git clone git://git.kernel.org/pub/scm/git/git.git
cd git
git checkout v1.6.4.2  # (2)

# (3)
./Documentation/install-doc-quick.sh \
  c8b9e605d51dd2f0c7ce6a363df31171af16534c \
  /usr/local/share/man

# (4)
./Documentation/install-doc-quick.sh \
  35b47ca5285a4059792ba937f8e09b2ab4a7adf4 \
  /usr/local/share/doc/git-doc

git init --help  # (5)

Notes:

  1. At this point, git will live in /usr/local/bin.
  2. Now you'll have the same tree as the previous step on a detached head.
  3. The SHA-1 comes from the last 1.6.4.2 commit in git log origin/man.
  4. Same as above, except from origin/html.
  5. Profit!
like image 81
Greg Bacon Avatar answered Sep 17 '22 12:09

Greg Bacon


Maybe not the answer you want, but you could just download the git-manpages-*.tar.gz and git-html-*.tar.gz that are published along with the source. They're published because the asciidoc toolchain is known to be a bit fragile, and a considerable effort to get everything installed and arranged.

You'd need, I believe, possibly a whole pack of docbook support files. Maybe some stylesheets as well... although if you have xmlto installed you should have got all these.

like image 43
araqnid Avatar answered Sep 18 '22 12:09

araqnid