Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In trying to get g++ to work in terminal I ran a command which I have now learned is outdated.

I think this is why running g++ in terminal returns an error but I am unsure.

If I try to run any .cpp in terminal I get the error message:

xcrun: Error: failed to exec real xcrun. (No such file or directory)

I have xcode installed and have installed command line tools. However after doing so, I ran the command below:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/

What have I done, and what should I do?

share|improve this question
Wait, you're trying to run a .cpp (C++ source code) file, as opposed to compile it? What happens if you just do g++ -o program program.cpp ? – derobert Nov 19 '13 at 16:15
What command did you type that gave the xcrun error? – Warren Young Nov 19 '13 at 16:19

Your Answer


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

Browse other questions tagged or ask your own question.