gcc: command not found

Discussion in 'Mac Programming' started by BashStreetYouth, Jan 9, 2008.

  1. BashStreetYouth macrumors member

    Joined:
    Dec 28, 2007
    #1
    Hi, thought i'd start doing a bit of c programming and installed xcode from the leopard cd. Tried a basic hello world in the terminal and it says gcc not found. It's there in /Developer/usr/bin What do i do? :eek:
     
  2. yeroen macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #2
    Add /Developer/usr/bin to your $PATH environment variable.

    That is in your $HOME/.bash_profile file add this line:

    export PATH=$PATH:/Developer/usr/bin/
     
  3. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #3
    The installer should set the path for you. What was the installer called that you clicked on? There is a main installer and two sub installers, you should only run the main one.
     
  4. titaniumdecoy macrumors member

    Joined:
    Oct 13, 2005
  5. BashStreetYouth thread starter macrumors member

    Joined:
    Dec 28, 2007
    #5
    ok, i tried the export PATH thing although i did not have a .bash_profile or .bashrc file so i created one. Still gcc not found.

    EDIT: scrap that. I logged out and back in and it was fine.

    I installed off the Leopard dvd from /optional installs/xcode tools/xcodetools.mpkg

    I tried cc also but no go. gcc and cc work if i go to /Developer/usr/bin in terminal and run ./gcc or./cc from there. When i did run from there, my simple hello world came up with: error: stdio.h: No such file or directory.

    Should i reinstall? or set the PATH also.
     
  6. yeroen macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #6
    can you show us the commands you're using to compile your program?
     
  7. BashStreetYouth thread starter macrumors member

    Joined:
    Dec 28, 2007
    #7
    gcc hello.c -o hello

    If i reinstall should i first just drag the Developer folder to the trash? Will that get rid of everything?
     
  8. Kofi90 macrumors newbie

    Joined:
    Mar 26, 2013
    #8
    Sorry to bump an old thread. I'm completely new to coding and have recently installed Xcode. I'm aware that I can run files within Xcode but when trying to compile them within terminal (or X11), I have the same error:

    "-bash: gcc: command not found"

    I would be happy to implement what seems to have worked for bashstreetyouth, however, I don't know how to perform the suggested task.

    Is any assistance regarding this possible?

    Mac OS X (Lion) 10.7.5
    Xcode: 4.6.1
    Terminal 2.2.3
     
  9. moviebiz macrumors member

    Joined:
    Jul 3, 2007
    #9
    Did you install the Command Line Tools? The install is optional and can be found in Xcode's Preferences under the Downloads tab. Make sure you're looking at components and you should see a button to install/download the Command Line Tools.
     
  10. Khachidze macrumors newbie

    Khachidze

    Joined:
    Mar 26, 2013
    #10
    i have some problems and is it need to install line tools? is other way?
     
  11. moviebiz macrumors member

    Joined:
    Jul 3, 2007
    #11
    I don't understand your question.
     
  12. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #12
    What problem are you having?
     
  13. Khachidze macrumors newbie

    Khachidze

    Joined:
    Mar 26, 2013
    #13
    installation problem.

    sorry,my english is bad
     
  14. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #14
    What exactly are you trying to install? Xcode from the App Store, Xcode from developer.apple.com, the Command Line Tools from Xcode, or something else?

    What is the exact error message you are getting? (If your OS isn't in English, post the original here for incase someone knows the language + a translation, possibly from Google translate if you can't do it yourself, for incase no one else knows the language.)
     

Share This Page