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:

$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: $ 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:

$brew link pkg-config Linking /usr/local/Cellar/pkg-config/0.25... 2 symlinks created  and now let’s try again: $ brew install lighttpd
==> Installing lighttpd dependency: pcre
######################################################################## 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

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.