Brand new OS X Lion doesn’t have the command line C compilers.In addition to that,Apple has changed the way of installing those compilers in /usr/bin once again.Here is how you do it with the latest Xcode and Lion.
Seven months ago,in august,right after OS X 10.7 Lion came out,there were numerous complains about new installation missing the C compilers in the expected place,/usr/bin.There are quite few articles on how you can change it the way it is expected by just downloading and installing Apple’s Xcode IDE.However,recently,professor Ulf von Barth of Lund University in Sweden made a statement that the mechanism has changed again.Now you have to do a little more,than before.
There are many reasons not to have a c compiler chilling on an average user’s Mac,ready to shake up trouble if accessed my malware.That’s why it’s not in the Mac by default.Nevertheless,there are also reasons for which you might want to have it on your computer,whether you’re a researcher and you don’t use Xcode for scientific computing.Or you’re taking a C class and want to use a C compiler from the command line.You may also be an administrator and you want the C compiler to available in a lab setting.Whatever your reasoning is,here are the steps you need to take.Sidenote:unlike the good old days,when everything was free,you now need to be a registered Mac developer.
Procedure
1) Download Xcode, now at version 4.3.2, just as before, from the Mac App Store. Finder -> Apple -> App Store… It is free.
2) Launch the Xcode.app that was downloaded to /Applications.
3) If you stop there, you’ll find that, unlike before, the command line compilers are not installed by default. You can go searching for them, and you’ll find it all in:
/Applications/Xcode.app/Contents/Developer/usr/bin

Okay,now that won’t do you any good,unless you intend to use Xcode exlusively. There is a great possibility that all your scripts won’t know where to find the C compilers(and assembler and linker)now.You wouldn’t want to modify them anyway.What you need is everything back in /usr/bin – the way it was before.
4) After launching Xcode, go to Preferences and select the Downloads pane, then Components. There, in the list of candidate items will be the Command Line Tools. Click “Install.”

5) You’ll be prompted for your developer credentials…

…then you’ll see the classic progress bar. When that’s done, the C compilers will all be in /usr/bin, as desired. To prove that all’s well, open a terminal window, cd to /usr bin, and take a look…

It might seem a little too difficult at first,but it’s understood why Apple thinks that majority of users don’t need these tools.And the ones that do will find how to get them.