1

My CLion does not allow me to compile with this message below. Any way to fix this?

/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /Users/name/CLionProjects/untitled118
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - broken
CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (message):
 message(FATAL_ERROR "The C compiler\n  \"${CMAKE_C_COMPILER}\"\n"

  The C compiler

    "/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/name/CLionProjects/untitled118/cmake-build-debug/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/usr/bin/make cmTC_5c666/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.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


-- Configuring incomplete, errors occurred!
See also "/Users/name/CLionProjects/untitled118/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/Users/name/CLionProjects/untitled118/cmake-build-debug/CMakeFiles/CMakeError.log".
Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
that_guy09
  • 13
  • 3
  • This has nothing to do with CLion. It doesn't come with a compiler, it just uses one on your system (through CMake). If that compiler is broken, there's not much it can do. You can always tell it where a working compiler is, but your system compiler being broken is quite worrying. It would seem [others have had such an issue](https://stackoverflow.com/questions/58278260/cant-compile-a-c-program-on-a-mac-after-upgrading-to-catalina-10-15). That said, I would test the compiler from the command line yourself with a minimal test program. – chris Apr 05 '21 at 04:55
  • 1
    Also try searching the error it gave you. For example, I found [this post](https://ma.ttias.be/mac-os-xcrun-error-invalid-active-developer-path-missing-xcrun/) with the same xcrun error. – chris Apr 05 '21 at 04:59

1 Answers1

0

You are missing the command line tools. This happens very often after updates to XCode and/or macOS. The tools which are from the prior version will be removed, however the new tools will not be installed.The way to fix this problem is:

  1. Follow the instruction for the latest version of XCode for installing the command line tools. This can be done over command line, as well as trough the preferences of XCode.
  2. Clean and Rebuild the CMake project from CLion in order to regenerate the Makefile based on the latest paths.
jordanvrtanoski
  • 5,104
  • 1
  • 20
  • 29