You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MacOS Ventura下CLion提示C编译器识别未知问题求助

修复MacOS Ventura更新后CLion中C编译器报错问题

问题现象

更新MacOS Ventura并同步更新CLion后,打开C项目时出现编译错误,核心报错为xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun,完整报错日志如下:

/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/Applications/CLion.app/Contents/bin/ninja/mac/ninja -G Ninja -S /Users/nikita/Documents/CLion/untitled -B /Users/nikita/Documents/CLion/untitled/cmake-build-debug
-- The C compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- 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.23/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/nikita/Documents/CLion/untitled/cmake-build-debug/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/Applications/CLion.app/Contents/bin/ninja/mac/ninja cmTC_6cb20 && [1/2] Building C object CMakeFiles/cmTC_6cb20.dir/testCCompiler.c.o
    FAILED: CMakeFiles/cmTC_6cb20.dir/testCCompiler.c.o 
    /usr/bin/cc   -arch arm64 -o CMakeFiles/cmTC_6cb20.dir/testCCompiler.c.o -c /Users/nikita/Documents/CLion/untitled/cmake-build-debug/CMakeFiles/CMakeTmp/testCCompiler.c
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    ninja: build stopped: subcommand failed.
    
    
  
  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/nikita/Documents/CLion/untitled/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/Users/nikita/Documents/CLion/untitled/cmake-build-debug/CMakeFiles/CMakeError.log".

[Finished]

修复步骤

  • 打开终端,执行命令安装/修复Xcode Command Line Tools:
    xcode-select --install
    
    执行后会弹出系统安装窗口,按提示完成安装。
  • 若安装后问题仍存在,执行命令重置Command Line Tools路径:
    sudo xcode-select --switch /Library/Developer/CommandLineTools
    
    输入系统密码确认执行即可。
  • 重启CLion,重新打开项目并尝试构建。

原因说明

MacOS系统更新后,Xcode Command Line Tools的关联路径可能被重置或损坏,导致CLion调用的/usr/bin/cc无法找到正确的编译工具链,触发错误。重新安装或重置路径即可恢复正常编译环境。

内容的提问来源于stack exchange,提问作者khrushchew

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.14 17:02:25