Clion doesnt compile on MacOS Sierra
After I updated my macOS to 10.12 sierra, Clion cant compile, debug or run my projects. I already tried to reinstall and search in the forum for some solution but I could not resolve this problem.
Here is my error log:
Error:The C compiler "/usr/bin/cc" is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/juniorlima/Library/Caches/CLion2016.2/cmake/generated/lesk-e04046c3/e04046c3/__default__/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_ab383/fast"
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
CMake will not be able to correctly generate this project.
Error:Configuration Debug
The C compiler "/usr/bin/cc" is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/juniorlima/Library/Caches/CLion2016.2/cmake/generated/lesk-e04046c3/e04046c3/Debug/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_4c8ea/fast"
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
CMake will not be able to correctly generate this project.
Error:Configuration Release
The C compiler "/usr/bin/cc" is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/juniorlima/Library/Caches/CLion2016.2/cmake/generated/lesk-e04046c3/e04046c3/Release/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_d38b8/fast"
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
CMake will not be able to correctly generate this project.
Error:Configuration RelWithDebInfo
The C compiler "/usr/bin/cc" is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/juniorlima/Library/Caches/CLion2016.2/cmake/generated/lesk-e04046c3/e04046c3/RelWithDebInfo/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_67d49/fast"
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
CMake will not be able to correctly generate this project.
Error:Configuration MinSizeRel
The C compiler "/usr/bin/cc" is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/juniorlima/Library/Caches/CLion2016.2/cmake/generated/lesk-e04046c3/e04046c3/MinSizeRel/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_d2011/fast"
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
CMake will not be able to correctly generate this project.
请先登录再写评论。
Hi Alimaj.
Please re-install Xcode developer tools via
in terminal.
Hello!
Thanks a lot Anna Filippova.
I have been struggling with that error for about 1 week. Now it is working.
Best regards,
Roger
Hello!
I've got the same problems with Alimaj's after upgrading MacOS X to Sierra.
But it didn't help to try the command that Anna provided. The error is still the same as below, anyone can help?
@Wangzhiy
I had the same problem. For me, the fix was to agree to the xcode license. To do that, open up a terminal and enter the following command:
sudo xcodebuild -license
Once you've entered your sudo password the license will then be presented on screen, hit the space bar to scroll through the text. When you get to the end of the text, you'll be prompted to enter 'agree', type this in, and then, back in CLion, click on File->Reload CMake Project and everything should work.
Good luck.
Cheers
Barry
I had the same problem, and it worked only after I did both steps.
Thank you very much Anna and Barry.
Nadav
This also solves the problem where you can make the project from the command line, but CLion cant with this error
Thank you Barry
Hi. My issue is after I remove Xcode. But I still do have Command Line Tools, which include all the necessary compilers such as clang, gcc. The error that I read is the following:
/Applications/CLion.app/Contents/bin/cmake/bin/cmake --build /Users/hsl/CLionProjects/Test_sololearn/cmake-build-debug --target untitled -- -j 2
Scanning dependencies of target untitled
[ 50%] Building CXX object CMakeFiles/untitled.dir/main.cpp.o
make[3]: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++: No such file or directory
make[3]: *** [CMakeFiles/untitled.dir/main.cpp.o] Error 1
make[2]: *** [CMakeFiles/untitled.dir/all] Error 2
make[1]: *** [CMakeFiles/untitled.dir/rule] Error 2
make: *** [untitled] Error 2
I would appreciate some help.
Hi
what solved the problem for me was to install & open XCODE, and afterwards to agree to software requirements.
Apparently XCODE makes some difference on macOS for C & C++ programming...
So many thank for Anna and Barry, I solved this problem by completing both steps, just one tip, when terminal ask you to enter the sudo password, that's the password you used to open your Macbook