Sign up ×
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.

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/

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.