By ear, always. It's an invaluable way to improve your ear, which makes you a better musician. If you ever plan to jam with other musicians, especially in an improvisational context, your ear is the most important thing you have.
Another benefit is that it's much faster than using TABs. I can usually visualize how to play a song as I hear it, before I even pickup the guitar. That's from years of learning songs by ear.
Another benefit is that it enables you to pickup songs for which no sheet music/TAB is available, or songs which aren't even written for guitar. For instance, my girlfriend and I have been getting into
Dr. Horribles Sing-Along Blog, and I'd learned most of those songs on guitar within minutes and was playing along. Can't do that if you haven't trained your ear and are reliant on someone literally telling you where to put your fingers (TAB).
The only time I've ever looked at a TAB is when the transcriber was a professional who had access to the master tracks (i.e. isolated guitar tracks), so I know he was able to hear stuff I can't.