Error using mex on Catalina: "xcodebuild: error: SDK "macosx10.15.4" cannot be located"
23 views (last 30 days)
Show older comments
MathWorks Support Team
on 24 Apr 2020
Edited: MathWorks Support Team
on 24 Nov 2020
After upgrading to MacOS Catalina, I am getting the following error when using the "mex" command:
Error using mexxcodebuild: error: SDK "macosx10.15.4" cannot be located.xcrun: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk macosx10.15.4 -find clang 2> /dev/null' failed with exit code 16384: (null) (errno=No such file or directory)xcrun: error: unable to find utility "clang", not a developer tool or in PATH
What is the cause of this error and how can I fix it?
Accepted Answer
MathWorks Support Team
on 12 May 2020
Edited: MathWorks Support Team
on 24 Nov 2020
This is due to an issue where when the "mexopts" files query the SDK version, "macosx10.15.4" is returned when the name of the SDK is actually just "macosx10.15" (major and minor version, no patch number).
In order to work around this, run the following in MATLAB:
>> cd(prefdir)
>> mex -setup % or mex -setup C++
Find the XML files in the Current Folder called "mex_C_maci64.xml" and/or "mex_C++_maci64.xml". Then change the following line:
<SDKVER> <cmdReturns name="xcrun -sdk macosx --show-sdk-version"/>
</SDKVER>
to
<SDKVER>
<cmdReturns name="xcrun -sdk macosx --show-sdk-version | awk 'BEGIN {FS="."} ; {print $1"."$2}'"/>
</SDKVER>
Now MATLAB will be able to find the correct SDK. It may require a restart of MATLAB or of the computer.
Please see the following External Bug Report (EBR) for more details:
0 Comments
More Answers (0)
See Also
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!