Home Using git instaweb on a Mac
Post
Cancel

Using git instaweb on a Mac

Today I discovered git instaweb. This is a very cool feature that allows you to instantly view your local repository (the one in your current working directory) in a web browser. It was incredibly easy to setup on my Mac. I did some googling and found out not everyone thinks it is so easy to setup. This is because they either don’t have a web server installed or the web server that is installed (apache2) isn’t installed on a Mac the way git instaweb expects.

As you will see shortly, I was in good shape to use this feature because I was already using the Homebrew Package Manager.

Here is what happened the first time I tried using it:

1
2
$ git instaweb
lighttpd not found. Install lighttpd or use --httpd to specify another httpd daemon.

Like I said I use homebrew, so whenever I see an error like this the first thing I try doing is installing the necessary software using brew:

1
2
$ brew install lighttpd
Error: You must 'brew link pkg-config' before lighttpd can be installed

Ok, I thought, this might be a problem, but let’s just do what it is asking me to do:

1
2
$ brew link pkg-config
Linking /usr/local/Cellar/pkg-config/0.25... 2 symlinks created

and now let’s try again:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ brew install lighttpd
==> Installing lighttpd dependency: pcre
==> Downloading ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.
######################################################################## 100.0%
######################################################################## 100.0%==> ./configure --prefix=/usr/local/Cellar/pcre/8.30 --enable-utf8 --enable-unic
==> make test
==> make install
/usr/local/Cellar/pcre/8.30: 130 files, 3.2M, built in 34 seconds
==> Installing lighttpd
==> Downloading http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/lighttpd/1.4.30 --with-openssl --with
==> make install
Warning: /usr/local/sbin is not in your PATH
You can amend this by altering your ~/.bashrc file
==> Summary
/usr/local/Cellar/lighttpd/1.4.30: 40 files, 852K, built in 28 seconds

That was it. The next time I ran git instaweb it started up the web server and a browser and I was viewing my code repository.

![git instaweb screenshot][2]

[2]: /assets/images/git-instaweb-screenshot.png “Screenshot of my local repository”

This post is licensed under CC BY 4.0 by the author.

Doing Code Reviews with GitHub

Importing Subversion Into Git