Well it is possible to work for a tech company and stay in SF. You just need to work with a more restrictive set of job requirements. I got tired of doing the long commute in 2003 and decided to only look at companies within the city limits. It took a year to find something I really liked, but it was life-changing to be able to work and live in the same place and avoid the 50-mile one-way commute.
And, of course, you can start and operate your company out of SF (which is what I eventually did as well).
That alone seals it for me, I'm staying in NYC. Although maybe I'd get more work done if my immediate environment bored me to tears.