# New MacOS and Xcode update incompatible with Cmake?

**URL:** https://discourse.cmake.org/t/new-macos-and-xcode-update-incompatible-with-cmake/9876
**Category:** Usage
**Created:** [January 18, 2024, 5:39pm UTC](https://discourse.cmake.org/t/new-macos-and-xcode-update-incompatible-with-cmake/9876 "2024-01-18T17:39:29Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![alexgav02](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alexgav02/32/4196_2.png) [@alexgav02](https://discourse.cmake.org/u/alexgav02)
#### Post date: [January 18, 2024, 5:39pm UTC](https://discourse.cmake.org/t/new-macos-and-xcode-update-incompatible-with-cmake/9876/1 "2024-01-18T17:39:29Z")

</div>

I’ve been running code smoothly for the last few weeks up until today after my macOS updated to Sonoma 14.2.1 and Xcode to 15.2 overnight. I updated cmake using homebrew to the latest version: 3.28.1, but now I’m getting strange errors:

cmake -DCMAKE\_BUILD\_TYPE=Release -DCMAKE\_CXX\_STANDARD=17 -DCMAKE\_INSTALL\_PREFIX=$MU3EPREFIX/software/install $MU3EPREFIX/software/mu3eAna

CMake Warning at /usr/local/Cellar/cmake/3.28.1/share/cmake/Modules/Platform/Darwin-Initialize.cmake:308 (message):  
Ignoring CMAKE\_OSX\_SYSROOT value:

/Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk

because the directory does not exist.  
Call Stack (most recent call first):  
/usr/local/Cellar/cmake/3.28.1/share/cmake/Modules/CMakeSystemSpecificInitialize.cmake:34 (include)  
CMakeLists.txt:3 (project)

– The C compiler identification is AppleClang 15.0.0.15000100  
– The CXX compiler identification is AppleClang 15.0.0.15000100  
– Detecting C compiler ABI info  
– Detecting C compiler ABI info - failed  
– Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc  
– Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - broken  
CMake Error at /usr/local/Cellar/cmake/3.28.1/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message):  
The C compiler

```
"/Library/Developer/CommandLineTools/usr/bin/cc"

```

is not able to compile a simple test program.

It fails with the following output:

```
Change Dir: '/Users/alexgavin/Project/software/build/mu3eAna/CMakeFiles/CMakeScratch/TryCompile-Hnhd8Y'

Run Build Command(s): /usr/local/Cellar/cmake/3.28.1/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_a68cb/fast
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_a68cb.dir/build.make CMakeFiles/cmTC_a68cb.dir/build
Building C object CMakeFiles/cmTC_a68cb.dir/testCCompiler.c.o
/Library/Developer/CommandLineTools/usr/bin/cc -MD -MT CMakeFiles/cmTC_a68cb.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_a68cb.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_a68cb.dir/testCCompiler.c.o -c /Users/alexgavin/Project/software/build/mu3eAna/CMakeFiles/CMakeScratch/TryCompile-Hnhd8Y/testCCompiler.c
Linking C executable cmTC_a68cb
/usr/local/Cellar/cmake/3.28.1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a68cb.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/cc -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_a68cb.dir/testCCompiler.c.o -o cmTC_a68cb 
ld: library 'System' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_a68cb] Error 1
make: *** [cmTC_a68cb/fast] Error 2

```

CMake will not be able to correctly generate this project.  
Call Stack (most recent call first):  
CMakeLists.txt:3 (project)

– Configuring incomplete, errors occurred!

Anyone got any ideas?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [January 18, 2024, 8:53pm UTC](https://discourse.cmake.org/t/new-macos-and-xcode-update-incompatible-with-cmake/9876/2 "2024-01-18T20:53:32Z")

</div>

Delete your build directory and start with a fresh build.

---

<div class="post-metadata">

### Author: ![alexgav02](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alexgav02/32/4196_2.png) [@alexgav02](https://discourse.cmake.org/u/alexgav02)
#### Post date: [January 19, 2024, 10:29am UTC](https://discourse.cmake.org/t/new-macos-and-xcode-update-incompatible-with-cmake/9876/3 "2024-01-19T10:29:17Z")

</div>

Hi, thanks for your suggestion. I’ve tried uninstalling and reinstalling but to no avail. I’m using homebrew so I’m not sure if that’s the problem?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [January 19, 2024, 10:42am UTC](https://discourse.cmake.org/t/new-macos-and-xcode-update-incompatible-with-cmake/9876/4 "2024-01-19T10:42:48Z")

</div>

Please try the following minimal project, which should at least confirm whether you have a working toolchain and CMake installation:

_CMakeLists.txt_:

```cmake
cmake_minimum_required(VERSION 3.28)
project(minimal)

```

This works for me with essentially the same versions of things as you.

---

<div class="post-metadata">

### Author: ![Laur59](https://discourse.cmake.org/user_avatar/discourse.cmake.org/laur59/32/4200_2.png) [@Laur59](https://discourse.cmake.org/u/Laur59)
#### Post date: [January 19, 2024, 12:33pm UTC](https://discourse.cmake.org/t/new-macos-and-xcode-update-incompatible-with-cmake/9876/5 "2024-01-19T12:33:09Z")

</div>

I am using too Sonoma (14.2.1) and cmake 3.28.1. I use cmake installed with the package downloaded from [cmake.org](http://cmake.org)

---

<div class="post-metadata">

### Author: ![scivision](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@scivision](https://discourse.cmake.org/u/scivision)
#### Post date: [January 19, 2024, 1:06pm UTC](https://discourse.cmake.org/t/new-macos-and-xcode-update-incompatible-with-cmake/9876/6 "2024-01-19T13:06:13Z")

</div>

He means the build directory. This error happens sometimes when I update macos like that too across projects.

Say I previously did

```auto
cmake -B build

```

For some project, then macos/xcode upgrades ad I get that error. In that same directory as before I do

```auto
rm -r build

cmake -B build

```

And all is well.

---

<div class="post-metadata">

### Author: ![alexgav02](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alexgav02/32/4196_2.png) [@alexgav02](https://discourse.cmake.org/u/alexgav02)
#### Post date: [January 19, 2024, 2:07pm UTC](https://discourse.cmake.org/t/new-macos-and-xcode-update-incompatible-with-cmake/9876/7 "2024-01-19T14:07:01Z")

</div>

Hi, thanks for the reply. I’m not too familiar with cmake and only really use it to compile code that uses cmake files (I did not write them). I uninstalled cmake with homebrew and tried to build from scratch and I’ve got up to make install but now it’s requesting a password and administrative privileges so I’m not really sure what’s going on. Do you perhaps know what the equivalent of this fix is for cmake installed with homebrew?

---

<div class="post-metadata">

### Author: ![alexgav02](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alexgav02/32/4196_2.png) [@alexgav02](https://discourse.cmake.org/u/alexgav02)
#### Post date: [January 19, 2024, 2:25pm UTC](https://discourse.cmake.org/t/new-macos-and-xcode-update-incompatible-with-cmake/9876/8 "2024-01-19T14:25:03Z")

</div>

I tried this and got the following output:

cmake CMakeLists.txt

– The C compiler identification is AppleClang 15.0.0.15000100

– The CXX compiler identification is AppleClang 15.0.0.15000100

– Detecting C compiler ABI info

– Detecting C compiler ABI info - done

– Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped

– Detecting C compile features

– Detecting C compile features - done

– Detecting CXX compiler ABI info

– Detecting CXX compiler ABI info - done

– Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped

– Detecting CXX compile features

– Detecting CXX compile features - done

– Configuring done (23.0s)

– Generating done (0.0s)

– Build files have been written to: /Users/alexgavin/software/cmake/test

---

<div class="post-metadata">

### Author: ![alexgav02](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alexgav02/32/4196_2.png) [@alexgav02](https://discourse.cmake.org/u/alexgav02)
#### Post date: [January 19, 2024, 2:53pm UTC](https://discourse.cmake.org/t/new-macos-and-xcode-update-incompatible-with-cmake/9876/9 "2024-01-19T14:53:42Z")

</div>

Thanks for everyone’s suggestions. After hours searching Google somebody recommended trying the command:

export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)

It seemed to fix things (I think the SDK path was wrong?) although I’m getting some deprecation errors, but at least it works!
