Jeff Mesnil
Weblog · About

Gitweb setup on Mac OS X

July 31, 2008

Update: I have written a new post for an updated setup with a more recent version of Git.

This post is for future references since I had to slightly adapt what is written in the INSTALL file to run Gitweb on my MacBook.

Assuming all my Git projects are in /Users/jmesnil/Work/ and I've already installed Git using MacPorts (sudo port install git-core), the steps to create gitweb.cgi is:

cd ~/Work
# retrieve the latest version of git
git clone git://git.kernel.org/pub/scm/git/git.git
cd git/
make GITWEB_PROJECTROOT="/Users/jmesnil/Work/" \
     GITWEB_CSS="/gitweb/gitweb.css" \
     GITWEB_LOGO="/gitweb/git-logo.png"  \
     GITWEB_FAVICON="/gitweb/git-favicon.png"  \
     bindir=/opt/local/bin
     gitweb/gitweb.cgi

# CGI scripts are located in /Library/WebServer/CGI-Executables
mkdir -p /Library/WebServer/CGI-Executables/gitweb
sudo cp gitweb/gitweb.cgi /Library/WebServer/CGI-Executables/gitweb/

# And the other resources are in /Library/WebServer/Documents/
mkdir -p /Library/WebServer/Documents/gitweb
sudo cp gitweb/gitweb.css gitweb/git-logo.png gitweb/git-favicon.png \   
   /Library/WebServer/Documents/gitweb/

Once everything is copied to the right place, Gitweb is up and running: http://localhost/cgi-bin/gitweb/gitweb.cgi?