Error using MEX in matlab r2016b with XCODE Version 8.3.2

1 view (last 30 days)
I am receiving the error
Error using mex
No supported compiler or SDK was found.
When I try to run mex -setup. I have already modified the clang++_maci64.xml and clang_maci64.xml files to contain
<dirExists name="$$/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk" />
<cmdReturns name="find $$ -name MacOSX10.12.sdk" />
But I still get the error. Please advise. Thanks.

Answers (1)

Prannay Jain
Prannay Jain on 1 May 2017
The error could sometimes happen if the licensing terms of XCode are not accepted. Hence, to fix the issue, XCode can be opened once and when the licensing window comes up, you can accept it. Also, you can also accept the licensing terms of XCode from terminal by running the following command:
sudo xcodebuild -license
In recent versions of XCode you can also accept the terms in single line of command:
sudo xcodebuild -license accept
Also, in R2016b, XCode 8.x is supported only for mex compilation, loadlibrary, and external usage of MATLAB Engine and MAT-files APIs. If you are using mex for something else like creating C/C++/Java libraries, only XCode 6.x and 7.x are supported. Refer to this link for more information:
You could also follow this MATLAB Answers post and as mentioned by Walter Roberson you have to make the changes (that you have mentioned in your post) for both ISYSROOT and SDKVER,
  1 Comment
hsw on 1 May 2017
Darn, I need it for creating a c++ library. Is there an easy way to get those xcode versions? thanks!

Sign in to comment.


Find more on Troubleshooting in MATLAB Compiler SDK 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!

Translated by