Why can't MEX find a supported compiler in MATLAB R2015b after I upgraded to Xcode 7.0?
27 views (last 30 days)
Show older comments
MathWorks Support Team
on 2 Oct 2015
Edited: MathWorks Support Team
on 17 Feb 2021
I installed Xcode 7.0 on my Mac and tried to use MEX. I receive the following error at the MATLAB command prompt:
ERROR: >> mex -setupError using mexNo supported compiler or SDK was found. For options, visithttp://www.mathworks.com/support/compilers/R2015a/maci64.html
Why does MATLAB not recognize the Xcode 7.0 installation on my Mac?
Accepted Answer
MathWorks Support Team
on 1 Feb 2021
Edited: MathWorks Support Team
on 17 Feb 2021
By default, MATLAB R2015b does not detect Xcode 7.x. To add support for Xcode 7.x in MATLAB R2015b, download the files attached to this article. Please follow these instructions to download and install the files (screenshots were taken in Mac OS X 10.10.5 Yosemite):
1) Download the file xcode7_mexopts.zip, which you will find attached to this article. Extract the contents of xcode7_mexopts.zip to your Downloads directory. Extracting the ZIP file will create a directory in Downloads called xcode7_mexopts.
2) Open MATLAB R2015b. Navigate to MATLAB's preference directory by typing the following command in the command window:
>> cd( prefdir );
3) Using MATLAB's "Current Folder" browser, ensure that there are no XML files that begin with "mex_" (e.g. mex_C_maci64.xml). If such files exist, remove them from the preference directory.
4) Navigate to the MATLAB directory. In MATLAB, you can do so by entering the following command at the MATLAB command prompt:
>> cd( fullfile( matlabroot, 'bin', 'maci64', 'mexopts' ) );
5) Back up the original files in the mexopts directory. You can run the following MATLAB commands to back up the files:
>> mkdir mexoptsContentsOLD
>> movefile *.xml mexoptsContentsOLD/
Keep the backup separate from the downloaded files such that you can revert to the backup files if necessary.
6) Replace any files in the mexopts directory with the corresponding files in the Downloads folder, xcode7_mexopts. You can replace the files in MATLAB by entering the following command at the MATLAB command prompt:
>> movefile( '~/Downloads/xcode7_mexopts/*.xml', '.' );
7) Restart MATLAB R2015b. Execute "mex -setup" at the MATLAB command prompt as shown below and verify that MEX detects Xcode 7.0.
>> mex -setup
Alternate Solution:
The SDK needed could be in the Xcode package with the path:
/Applications/XCODE/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
Please place this in:
/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
This should resolve the issue.
If MEX continues to return an error, please contact
.
1 Comment
Walter Roberson
on 29 May 2017
See https://www.mathworks.com/matlabcentral/answers/303369-mex-cannot-find-a-supported-compiler-in-matlab-r2015b-after-i-upgraded-to-xcode-8-0#answer_235135 if you want my step-by-step instructions on doing this yourself. See https://www.mathworks.com/matlabcentral/answers/243868-mex-can-t-find-compiler-after-xcode-7-update-r2015b#comment_454130 if you want my edited files that have been recently tested for R2016a on MacOS Sierra with the latest XCode.
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!