How to test if gcc is installed?

How can I find out if I have gcc installed on my machine?

I am trying to run CodeRunner, but it isn't responding. I know you have to have gcc installed in order for it to work properly. I do have Xcode 4.0.2 installed (from what I've read, if Xcode is installed then you already have gcc).


Solution 1:

  1. Type gcc at the Terminal prompt. If it says "command not found", you don't. Otherwise, you do.
  2. If that fails, then install from your OSX CD.

Solution 2:

You could just try to see if a gcc executable is present. Try:

ls /usr/bin/gcc*

Solution 3:

You can use "locate gcc" to find all filenames with gcc in them.

Solution 4:

Try any terminal command, like:

$ gcc --help

If gcc isn't installed, you will often see a message with a "how to install it" note, complete with the package manager's command.