Error while installing Homebrew on Lion-Collection of common programming errors

I started installing Homebrew on my Mac Lion v10.7.4 but got the following error.

==> Downloading and Installing Homebrew...
Failed during: Error: /usr/bin/xcode-select returned unexpected error. init -q

I ran the following command as mentioned on Homebrew website:

ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"

I tried to search for solutions for this error but nothing relevant came up. How can this be fixed?

Thanks.