How can I use Gmail as the default mail client app in Mac OS X?
You do NOT need to install a third party app.

Both Google Chrome and Firefox support this functionality. (ok, technically these are third party apps, but lets assume you are not using safari.)

Chrome:


Open gmail in chrome. 
In the address bar next to the "bookmark star" you should see a grey diamond. Click on the diamond 
Select "use gmail".

If you do not see the gray diamond, follow the instructions below. 


If you made a mistake and selected "No" and you really wanted to select "Use Gmail"


With Chrome open, copy and paste this into your address bar at the top: chrome://settings/handlers
Under the Ignored protocol handlers section, Click on X to the right to delete.
Close and open Gmail. 
Answer the question correctly this time. :)


Source:
http://productforums.google.com/forum/#!topic/chrome/hnRteY7bHfE

Alternative way, if you need to do this programmatically.

Firefox:

See @Am1rr3zA answer on this question. Click here to jump to his answer.

Safari:

See @fpotter's answer on this question. Click here to jump to his answer.