I have been trying to install matplotlib through easy_install(easy_install-2.7 for python2.7) and by building from source(https://github.com/matplotlib/matplotlib).
But both fail with the error - "error: Setup script exited with error: command 'gcc' failed with exit status 1"
Not sure if it helps, but more of the error messaging here: http://pastebin.com/FiTth4kG
Prior to this i had successfully managed to install all other scientific libraries that i needed - numpy, scipy, pandas, sklearn. But am getting stuck with matplotlib.
To facilitate installations of numpy et al, i had installed quite a few other packages. (I dont't even remember which all)
I fear the worst and assume that some of these related package installations might have impacted some default setting on my Terminal.
All other solutions on SE point to having XCode and XCode command tools installed. But i have the latest version of both.
I see that my usr/bin/ has both gcc & gcc-4.2
Python verion being used - Python2.7 OS - Mac Mountain Lion
I have torn off half of my hair trying to get this installed. Please please heeeelp... before i go completely bald.
UPDATE: i have got it working by installing the .dmg (don't ask why i did not try that before - the easiest solution is at times the best solution)
But still want to know the reason for the above errors. I suspect i might encounter this menace on future installations.