Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have Xcode installed, but when I type gcc in terminal I get "command not found". Maybe I messed up the $PATH variable? What is suposed to be the default value?

EDIT:

(...):/ imac2$ echo $PATH

/opt/local/bin:/opt/local/sbin:/Applications/SenchaSDKTools-2.0.0-Beta/jsbuilder:/Applications/SenchaSDKTools-2.0.0-Beta/bin:/Applications/SenchaSDKTools-2.0.0-Beta:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
share|improve this question
    
Similar, with a similar accepted answer: OSX — How to use/install gcc on Mac OS X 10.8 / Xcode 4.4 — Stack Overflow –  Graham Perrin Apr 21 '12 at 10:12

2 Answers 2

up vote 9 down vote accepted

You need to install the Xcode command-line developer tools. Open Xcode and go to Xcode → Preferences → Downloads, select the Components tab, and click the button next to “Command Line Tools”.

See Is the installation of Xcode from App Store enough for having the developer tools?.

share|improve this answer
    
Since I have XCode4, dont I have it installed by default? It was 1.0GB+ download. –  Ricardo Apr 9 '12 at 16:57
1  
Thanks for your time. –  Ricardo Apr 9 '12 at 17:07
    
In previous Xcode, Command Line Tools used to be installed if you choose Standard Installation (and not Custom installation) when launching the Xcode installer. The latest Xcode is an app that is downloaded and installed by Mac App Store (i.e. no installer) hence no choice to include Command Line Tools during installation. Instead you have to download from within the installed Xcode using the steps (described in my answer). –  Global nomad Apr 9 '12 at 17:10
    
Installing the Command Line Tools. My connection is slow so I wont wait to test it I'll just go ahead and mark your answer as the correct, you were the first. Thanks anyway Global nomad! –  Ricardo Apr 9 '12 at 17:17

If you installed the latest Xcode 4.3.2, you'll need to download the optional Command Line Tools component before you can use Terminal to access it. To do this,

  1. click on the Preferences… menu
  2. a new window will appear, locate and click the Downloads icon at the top of that window.
  3. In the Components view on the left, click on the Install button on the right to install the Command Line Tools.

After you install it, you should something similar to the following enter image description here

share|improve this answer
1  
Thanks for your time. –  Ricardo Apr 9 '12 at 17:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.